Topic: OSD for openbox using aosd_cat
Hi Crunchbangers,
I thought you may be interested in on OSD volume control script using alsa-utils and aosd_cat (package called aosd-cat). I haven't actually checked if aosd_cat is in Ubuntu as I use Sid.
When muted the OSD color is red for the mute toggle and volume whilst muted otherwise it is yellow.
Obviously you can change to suit yourself. It also assumes ~/bin is in your path.
vi ~/bin/mixer-osd#!/bin/bash
#================================================================================
### mixer-osd
#================================================================================
case $1 in
volup) A="VOLUME: $(amixer sset Master 2dB+ | grep "Mono:" \
| awk '{print $4}' | tr -d '[]')" ;;
voldown) A="VOLUME: $(amixer sset Master 1dB- | grep "Mono:" \
| awk '{print $4}' | tr -d '[]')" ;;
mute)
case $(amixer set Master toggle | grep "Mono:" \
| awk '{print $6}' | tr -d '[]') in
on) A="UNMUTED" ;;
off) A="MUTED" ;;
esac ;;
*) echo "Usage: $0 { volup | voldown | mute }" ;;
esac
MUTESTATUS=$(amixer get Master | grep "Mono:" | awk '{print $6}' | tr -d '[]')
if [ $MUTESTATUS == "off" ]; then
OSDCOLOR=red; else
OSDCOLOR=yellow
fi
killall aosd_cat &> /dev/null
echo "$A" | aosd_cat -n "Sans 20 bold" -o 3000 -R $OSDCOLOR -f 0
# ENDchmod +x ~/bin/mixer-osdAssuming your Distro correctly detects your multimedia key presses for XF86AudioLowerVolume, XF86AudioRaiseVolume and XF86AudioMute then you can add something like this to your rc.xml
vi ~/.config/openbox/rc.xml<keybind key="XF86AudioLowerVolume">
<action name="Execute">
<execute>mixer-osd voldown</execute>
</action>
</keybind>
<keybind key="XF86AudioRaiseVolume">
<action name="Execute">
<execute>mixer-osd volup</execute>
</action>
</keybind>
<keybind key="XF86AudioMute">
<action name="Execute">
<execute>mixer-osd mute</execute>
</action>
</keybind>
