LukeSmithxyz / dwmblocks

My status bar: my build of the modular dwmblocks
GNU General Public License v2.0
430 stars 368 forks source link

help requested to figure out the right signal to send to kbselect process #53

Closed hakova closed 2 years ago

hakova commented 4 years ago

Hi there,

I am sorry if this is a too silly of a question. I modified your script for keyboard layout to include a layout for Turkish language. I would like to replicate what you did for volume control and other scripts that only update the dwmblocks in situation change but not regularly, every n seconds. However, I am having a hard time to get it to work. Below is a section from dwm/config.h file:

static const char *xkbscmd[] = { "xkbswitch", "&&", "kill", "-44", "$(pgrep dwmblocks)", NULL }; ... { MODKEY|ShiftMask, XK_k, spawn, {.v = xkbscmd } },

And here is the section in dwmblocks/blocks.h file:

{"", "kbselect", 0, 10}

xkbswitch effectively switches the keyboard layout with the right key combination. kbselect script initially displays the correct layout on status bar but fails to respond to the switch and doesn't update the keyboard layout on status bar.

Disclosures: I did not use the SHCMD style in dwm/config.h file but I doubt that this is the underlying problem, since dwm compiles fine without errors and responds to the correct key combination and does what it is supposed to do.

I had to modify the kbselect script slightly to make it work in OpenBSD, which is the OS I am currently working on.

I don't have a clue how to figure out which signal would be the right one to send to the process and I suspect that it may be different in OpenBSD as compared to linux. I would greatly appreciate the pointers if any.

Thanks for your time.

zamoranos commented 3 years ago

There are two user-defined signals for POSIX Standard signals, SIGUSR1 and SIGUSR2 https://dsa.cs.tsinghua.edu.cn/oj/static/unix_signal.html https://man.openbsd.org/signal.3 https://www.gnu.org/software/libc/manual/html_node/Miscellaneous-Signals.html

My dwm/config.h has something like: { MODKEY, XK_equal, spawn, SHCMD("sndioctl output.level=+0.05; pkill -SIGUSR1 dwmblocks") }, You can check out my build of dwm if you want because I also use OpenBSD (https://github.com/zamoranos/dwm)

For dwmblocks {"", "sb-volume", 0, 1},

You can probably use the remaining signal for changing keyboard layout.