diff options
| author | bakkeby <[email protected]> | 2020-09-08 16:57:31 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2020-09-08 16:57:31 +0200 |
| commit | b3e6e3531b79b4bcd6938f291f9658ca5bbc5dd2 (patch) | |
| tree | 5eaf4b3a8d04835b3fecac9e02cf8e1c1fd32b33 /patch | |
| parent | 95611ca0bd691416c23ea6c0ed00cfe454f601b5 (diff) | |
| download | dwm-flexipatch-b3e6e3531b79b4bcd6938f291f9658ca5bbc5dd2.tar.gz dwm-flexipatch-b3e6e3531b79b4bcd6938f291f9658ca5bbc5dd2.zip | |
ipc: adding function/signal bindings
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/ipc.c | 41 | ||||
| -rw-r--r-- | patch/ipc.h | 3 | ||||
| -rw-r--r-- | patch/vanitygaps.c | 4 |
3 files changed, 45 insertions, 3 deletions
diff --git a/patch/ipc.c b/patch/ipc.c index d46f53b..e863afc 100644 --- a/patch/ipc.c +++ b/patch/ipc.c @@ -57,4 +57,45 @@ setupepoll(void) if (ipc_init(ipcsockpath, epoll_fd, ipccommands, LENGTH(ipccommands)) < 0) fputs("Failed to initialize IPC\n", stderr); +} + +void +setstatus(const Arg *arg) +{ + Monitor *m; + #if BAR_EXTRASTATUS_PATCH + if (arg->v == NULL) { + strcpy(stext, "dwm-"VERSION); + estext[0] = '\0'; + } else { + strcpy(rawstext, arg->v); + char *e = strchr(rawstext, statussep); + if (e) { + *e = '\0'; e++; + #if BAR_STATUSCMD_PATCH + strncpy(rawestext, e, sizeof(estext) - 1); + copyvalidchars(estext, rawestext); + #else + strncpy(estext, e, sizeof(estext) - 1); + #endif // BAR_STATUSCMD_PATCH + } else { + estext[0] = '\0'; + } + #if BAR_STATUSCMD_PATCH + copyvalidchars(stext, rawstext); + #else + strncpy(stext, rawstext, sizeof(stext) - 1); + #endif // BAR_STATUSCMD_PATCH + } + #elif BAR_STATUSCMD_PATCH + if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext))) + strcpy(stext, "dwm-"VERSION); + else + copyvalidchars(stext, rawstext); + #else + if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) + strcpy(stext, "dwm-"VERSION); + #endif // BAR_EXTRASTATUS_PATCH | BAR_STATUSCMD_PATCH + for (m = mons; m; m = m->next) + drawbar(m); }
\ No newline at end of file diff --git a/patch/ipc.h b/patch/ipc.h index eba39a0..a07a42f 100644 --- a/patch/ipc.h +++ b/patch/ipc.h @@ -2,4 +2,5 @@ static int handlexevent(struct epoll_event *ev); static void setlayoutsafe(const Arg *arg); -static void setupepoll(void);
\ No newline at end of file +static void setupepoll(void); +static void setstatus(const Arg *arg);
\ No newline at end of file diff --git a/patch/vanitygaps.c b/patch/vanitygaps.c index 7bf65b9..5b8c7c1 100644 --- a/patch/vanitygaps.c +++ b/patch/vanitygaps.c @@ -18,7 +18,7 @@ setgaps(int oh, int ov, int ih, int iv) arrange(selmon); } -#if DWMC_PATCH +#if DWMC_PATCH || IPC_PATCH /* External function that takes one integer and splits it * into four gap values: * - outer horizontal (oh) @@ -70,7 +70,7 @@ setgapsex(const Arg *arg) setgaps(oh, ov, ih, iv); } -#endif // DWMC_PATCH +#endif // DWMC_PATCH | IPC_PATCH static void togglegaps(const Arg *arg) |
