summaryrefslogtreecommitdiffhomepage
path: root/patch/ipc.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-09-08 16:57:31 +0200
committerbakkeby <[email protected]>2020-09-08 16:57:31 +0200
commitb3e6e3531b79b4bcd6938f291f9658ca5bbc5dd2 (patch)
tree5eaf4b3a8d04835b3fecac9e02cf8e1c1fd32b33 /patch/ipc.c
parent95611ca0bd691416c23ea6c0ed00cfe454f601b5 (diff)
downloaddwm-flexipatch-b3e6e3531b79b4bcd6938f291f9658ca5bbc5dd2.tar.gz
dwm-flexipatch-b3e6e3531b79b4bcd6938f291f9658ca5bbc5dd2.zip
ipc: adding function/signal bindings
Diffstat (limited to 'patch/ipc.c')
-rw-r--r--patch/ipc.c41
1 files changed, 41 insertions, 0 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