I wanted an easier way to visualise the current volume because the volume icon on the uConsole Bookworm is tiny. I hacked together a quick OSD for volume and brightness using dunst. Hope you find them helpful!
Place the two scripts below in your preferred location and then modify ~/.config/wayfire.ini
to call them in addition to the current commands.
binding_light_up=KEY_BRIGHTNESSUP
command_light_up=brightnessctl s +1 && ~/.config/brightness_osd.sh
binding_light_down=KEY_BRIGHTNESSDOWN
command_light_down=brightnessctl s 1- && ~/.config/brightness_osd.sh
binding_volume_up=KEY_VOLUMEUP
command_volume_up=wfpanelctl volumepulse volu && ~/.config/volume_osd.sh
binding_volume_down=KEY_VOLUMEDOWN
command_volume_down=wfpanelctl volumepulse vold && ~/.config/volume_osd.sh
volume_osd.sh
#!/bin/bash
PERCENT=$(amixer sget Master | grep "Left:" | cut -d "[" -f 2 | cut -d "%" -f 1)
MUTED=$(amixer sget Master | grep -c "off")
if [ $MUTED -gt 0 ]
then
PERCENT="0"
fi
dunstify \
-h string:x-dunst-stack-tag:osd \
-h string:bgcolor:#888888ee \
-h string:hlcolor:#00bbff \
-h int:value:"$PERCENT" \
-t 1500 \
"Volume:"
brightness_osd.sh
#!/bin/bash
CURRENT=$(brightnessctl g)
MAX=$(brightnessctl m)
PERCENT=$((100*$CURRENT/$MAX))
dunstify \
-h string:x-dunst-stack-tag:osd \
-h string:bgcolor:#888888cc \
-h string:hlcolor:#00bbff \
-h int:value:"$PERCENT" \
-t 1500 \
"Brightness:"
6 Likes
Rex
July 22, 2024, 1:01am
2
Nice, that’s one thing I was missing just not enough to do anything about it. I installed it and made the scripts as soon as I seen this and it works well. Thanks!
1 Like
I updated my keyboard to the most recent firmware which includes mute.
volume_osd.sh in the OP has been patched to set PERCENT
to 0 when muted.
This is great! Do you have any idea of how to set this up on Xorg?
I updated my uconsole to use labwc when prompted. Doing so breaks to OSD.
Adding the following to the keyboard section of ~/.config/labwc/rc.xml restores it:
<keybind key="XF86_AudioLowerVolume">
<action name="Execute" command="amixer sset Master 5%-" />
<action name="Execute" command="~/.config/volume_osd.sh" />
</keybind>
<keybind key="XF86_AudioRaiseVolume">
<action name="Execute" command="amixer sset Master 5%+" />
<action name="Execute" command="~/.config/volume_osd.sh" />
</keybind>
<keybind key="XF86_AudioMute">
<action name="Execute" command="amixer sset Master toggle" />
<action name="Execute" command="~/.config/volume_osd.sh" />
</keybind>
<keybind key="XF86_MonBrightnessUp">
<action name="Execute" command="brightnessctl set +10%" />
<action name="Execute" command="~/.config/brightness_osd.sh" />
</keybind>
<keybind key="XF86_MonBrightnessDown">
<action name="Execute" command="brightnessctl set 10%-" />
<action name="Execute" command="~/.config/brightness_osd.sh" />
</keybind>
1 Like
Rex
November 5, 2024, 12:56am
6
that didn’t seem to work here is my rc.xml
<?xml version="1.0"?>
<openbox_config xmlns="http://openbox.org/3.4/rc"/>
<labwc_config>
<keyboard>
<keybind key="XF86_AudioLowerVolume">
<action name="Execute" command="amixer sset Master 5%-" />
<action name="Execute" command="~/.config/volume_osd.sh" />
</keybind>
<keybind key="XF86_AudioRaiseVolume">
<action name="Execute" command="amixer sset Master 5%+" />
<action name="Execute" command="~/.config/volume_osd.sh" />
</keybind>
<keybind key="XF86_AudioMute">
<action name="Execute" command="amixer sset Master toggle" />
<action name="Execute" command="~/.config/volume_osd.sh" />
</keybind>
<keybind key="XF86_MonBrightnessUp">
<action name="Execute" command="brightnessctl set +10%" />
<action name="Execute" command="~/.config/brightness_osd.sh" />
</keybind>
<keybind key="XF86_MonBrightnessDown">
<action name="Execute" command="brightnessctl set 10%-" />
<action name="Execute" command="~/.config/brightness_osd.sh" />
</keybind>
</keyboard>
</labwc_config>
my config was blank except this
<?xml version="1.0"?>
<openbox_config xmlns="http://openbox.org/3.4/rc"/>
Ahh I found that I had to ignore the bit about `<labwc_config> and instead have it be:
<?xml version="1.0"?>
<openbox_config xmlns="http://openbox.org/3.4/rc">
<keyboard>
<keybind key="XF86_AudioLowerVolume">
<action name="Execute" command="amixer sset Master 5%-" />
<action name="Execute" command="~/.config/volume_osd.sh" />
</keybind>
<keybind key="XF86_AudioRaiseVolume">
<action name="Execute" command="amixer sset Master 5%+" />
<action name="Execute" command="~/.config/volume_osd.sh" />
</keybind>
<keybind key="XF86_AudioMute">
<action name="Execute" command="amixer sset Master toggle" />
<action name="Execute" command="~/.config/volume_osd.sh" />
</keybind>
<keybind key="XF86_MonBrightnessUp">
<action name="Execute" command="brightnessctl set +10%" />
<action name="Execute" command="~/.config/brightness_osd.sh" />
</keybind>
<keybind key="XF86_MonBrightnessDown">
<action name="Execute" command="brightnessctl set 10%-" />
<action name="Execute" command="~/.config/brightness_osd.sh" />
</keybind>
</keyboard>
</openbox_config>
3 Likes
Rex
November 5, 2024, 2:02am
8
That did the trick! Great work again on the OSD.
1 Like