Upgraded the dwmblocks patch for statuscmd which changes the signalling
mechanism from SIGUSR1 to SIGRTMIN which is likely to cause issues for those that already have a working setup. A compatibility option has been added which changes this back to SIGUSR1. Note that configuration was also changed. This was ref. reported issue #114.pull/143/head
parent
bd5f5608a3
commit
7efb64d685
@ -1,31 +1,50 @@
|
|||||||
static int dwmblockssig;
|
static int statussig;
|
||||||
pid_t dwmblockspid = 0;
|
pid_t statuspid = -1;
|
||||||
|
|
||||||
int
|
pid_t
|
||||||
getdwmblockspid()
|
getstatusbarpid()
|
||||||
{
|
{
|
||||||
char buf[16];
|
char buf[32], *str = buf, *c;
|
||||||
FILE *fp = popen("pidof -s dwmblocks", "r");
|
FILE *fp;
|
||||||
if (fgets(buf, sizeof(buf), fp));
|
|
||||||
pid_t pid = strtoul(buf, NULL, 10);
|
if (statuspid > 0) {
|
||||||
|
snprintf(buf, sizeof(buf), "/proc/%u/cmdline", statuspid);
|
||||||
|
if ((fp = fopen(buf, "r"))) {
|
||||||
|
fgets(buf, sizeof(buf), fp);
|
||||||
|
while ((c = strchr(str, '/')))
|
||||||
|
str = c + 1;
|
||||||
|
fclose(fp);
|
||||||
|
if (!strcmp(str, STATUSBAR))
|
||||||
|
return statuspid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!(fp = popen("pidof -s "STATUSBAR, "r")))
|
||||||
|
return -1;
|
||||||
|
fgets(buf, sizeof(buf), fp);
|
||||||
pclose(fp);
|
pclose(fp);
|
||||||
dwmblockspid = pid;
|
return strtol(buf, NULL, 10);
|
||||||
return pid != 0 ? 0 : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sigdwmblocks(const Arg *arg)
|
sigstatusbar(const Arg *arg)
|
||||||
{
|
{
|
||||||
union sigval sv;
|
union sigval sv;
|
||||||
sv.sival_int = (dwmblockssig << 8) | arg->i;
|
|
||||||
if (!dwmblockspid)
|
if (!statussig)
|
||||||
if (getdwmblockspid() == -1)
|
return;
|
||||||
|
if ((statuspid = getstatusbarpid()) <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sigqueue(dwmblockspid, SIGUSR1, sv) == -1) {
|
#if BAR_DWMBLOCKS_SIGUSR1_PATCH
|
||||||
|
sv.sival_int = (statussig << 8) | arg->i;
|
||||||
|
if (sigqueue(statuspid, SIGUSR1, sv) == -1) {
|
||||||
if (errno == ESRCH) {
|
if (errno == ESRCH) {
|
||||||
if (!getdwmblockspid())
|
if (!getstatusbarpid())
|
||||||
sigqueue(dwmblockspid, SIGUSR1, sv);
|
sigqueue(statuspid, SIGUSR1, sv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
sv.sival_int = arg->i;
|
||||||
|
sigqueue(statuspid, SIGRTMIN+statussig, sv);
|
||||||
|
#endif // BAR_DWMBLOCKS_SIGUSR1_PATCH
|
||||||
}
|
}
|
@ -1,2 +1,2 @@
|
|||||||
static int getdwmblockspid();
|
static int getstatusbarpid();
|
||||||
static void sigdwmblocks(const Arg *arg);
|
static void sigstatusbar(const Arg *arg);
|
Loading…
Reference in New Issue