Closed twoeightdev closed 2 years ago
Did you patch your dwm
as mentioned in the README under the clickability section?
At a glance, everything you have here seems fine.
Did you patch your
dwm
as mentioned in the README under the clickability section? At a glance, everything you have here seems fine.
yes sir i already did. i use this to patch dwm. i use the statuscmd-status2d the one wtih signal.
i have this on my dwm
#define STATUSBAR "dwmblocks"
{ ClkStatusText, 0, Button1, sigstatusbar, {.i = 1} },
{ ClkStatusText, 0, Button2, sigstatusbar, {.i = 2} },
{ ClkStatusText, 0, Button3, sigstatusbar, {.i = 3} },
You've applied the patch for status2d, but you need to change a line in the source code of dwm
. Change these lines:
return statuspid;
}
}
- if (!(fp = popen("pidof -s "STATUSBAR, "r")))
+ if (!(fp = popen("pgrep -o "STATUSBAR, "r")))
return -1;
fgets(buf, sizeof(buf), fp);
pclose(fp);
This is covered in the README. It you do this properly, clickability will start working.
You've applied the patch for status2d, but you need to change a line in the source code of dwm. Change these lines:
return statuspid; } } - if (!(fp = popen("pidof -s "STATUSBAR, "r"))) + if (!(fp = popen("pgrep -o "STATUSBAR, "r"))) return -1; fgets(buf, sizeof(buf), fp); pclose(fp);
yea i already did that:
pid_t
getstatusbarpid()
{
char buf[32], *str = buf, *c;
FILE *fp;
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("pgrep -s "STATUSBAR, "r")))
return -1;
fgets(buf, sizeof(buf), fp);
pclose(fp);
return strtoul(buf, NULL, 10);
}
btw im using this on fresh dwm 6.3 no other patch atm only this.
oops i think the pgrep -s
and should be pgrep -o
makes it not working. i'll try and report sir.
Edit: Fixed! thank you sir 😊
oops i think the
pgrep -s
and should bepgrep -o
makes it not working. i'll try and report sir.
Yeah, double check that command as it is responsible for sending click events to dwmblocks.
Also, for debugging, ensure that you only have one instance of dwmblocks running by using
killall -9 dwmblocks
And then launching dwmblocks.
Hey sorry to reopen this but I'm having the same problem and changing pgrep -s to pgrep -o doesn't seem to fix it. Here is my config of dwmblocks:
#define CMDLENGTH 60
#define DELIMITER " "
#define CLICKABLE_BLOCKS
const Block blocks[] = {
BLOCK("sb-test", 1, 17),
};
Here is the script "sb-test":
#!/bin/sh
case $BLOCK_BUTTON in
1) notify-send "hello" ;;
esac
case $BUTTON in
1) notify-send "hello" ;;
esac
echo "hello"
I added a second case statement with the $BUTTON variable since that's what it's used on the example on the page for the statuscmd patch but it didn't work either. Here is the relevant seccion of dwm.c just in case:
fclose(fp);
if (!strcmp(str, STATUSBAR))
return statuspid;
}
}
if (!(fp = popen("pidof -o "STATUSBAR, "r")))
return -1;
fgets(buf, sizeof(buf), fp);
pclose(fp);
return strtol(buf, NULL, 10);
I tested everything on a fresh install of dwm, only the statuscmd patch applied. I'm really lost on how to get this working so I appreciate any help :D
It should work with the statsuscmd patch and changing the line I mentioned in the README to pgrep
. Also, please use the $BLOCK_BUTTON
variable.
You could try debugging this:
# Have only one block in config.h, set interval to 0
# Kill all previous instances
killall dwmblocks -9
# Create a new instance of dwmblocks and watch its stacktrace for signals
strace -e 'trace=!all' dwmblocks
Check if you get any updates in strace on clicking on the statusbar.
hi, thanks for your work, everythings good but i'm having problem with clicking on the blocks as it does nothing. here is my config:
and here is the script for
sb-news
i use this statuscmd-status2d-with-signal
did i do it all correctly?😅 thanks for the help
Edit: distro- Void linux