dwmblocks icon indicating copy to clipboard operation
dwmblocks copied to clipboard

Volume display on OpenBSD

Open swindlesmccoop opened this issue 1 year ago • 1 comments

When I was using i3blocks, I was able to enter either while true; do [command]; sleep 0.1 to update a command every 0.1 seconds. Now I've read that you can use signals to tell it when to update since the program does not support floating numbers. What is the signal that I need to use for it to update? I think it was 10 when I used Linux but since I am on OpenBSD I think that it's different. However, the ones I have tried (23 and 32) do not seem to work.

swindlesmccoop avatar Jul 15 '22 23:07 swindlesmccoop

I did a bit of investigating and realized that I was using signals wrong...anyways, what I figured out is that I needed my script to actually send the signal to the dwmblocks process. The only problem is that all of the blocks to the right of the block where the signal is defined as 1 are truncated. I have attached my blocks.h file for debugging if that's helpful. blocks.h

swindlesmccoop avatar Jul 16 '22 01:07 swindlesmccoop

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

I also use OpenBSD btw. For volume control, My dwm/config.h has something like this: { MODKEY, XK_equal, spawn, SHCMD("sndioctl output.level=+0.05; pkill -SIGUSR1 dwmblocks") },

In dwmblocks: {"", "sb-volume", 0, 1},

zamoranos avatar Aug 25 '22 12:08 zamoranos

That looks like it would work. Do you know how to bind the actual media keys like on a laptop (in my case the ThinkPad T420) in config.h so that they can run that command instead of whatever arbitrary command its running?

swindlesmccoop avatar Sep 01 '22 18:09 swindlesmccoop

I think this will do: { 0, XF86XK_AudioMute, spawn, SHCMD("pkill -SIGUSR1 dwmblocks") }, { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pkill -SIGUSR1 dwmblocks") }, { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pkill -SIGUSR1 dwmblocks") },

zamoranos avatar Sep 02 '22 13:09 zamoranos

Thank you! This is quite literally the exact thing I was looking for. In case anyone finds this on Google or something, in order to fix the error: use of undeclared identifier 'XF86XK_AudioRaiseVolume' error, you need to add a line above all of the keybinds with #include <X11/XF86keysym.h>

swindlesmccoop avatar Sep 03 '22 01:09 swindlesmccoop