ipc: adding function/signal bindings

This commit is contained in:
bakkeby
2020-09-08 16:57:31 +02:00
parent 95611ca0bd
commit b3e6e3531b
5 changed files with 375 additions and 190 deletions

View File

@@ -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);
}

View File

@@ -2,4 +2,5 @@
static int handlexevent(struct epoll_event *ev);
static void setlayoutsafe(const Arg *arg);
static void setupepoll(void);
static void setupepoll(void);
static void setstatus(const Arg *arg);

View File

@@ -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)