Volume/Brightness OSD

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:"
4 Likes

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?