OpenBSD Volume Control Widget
From awesome
OpenBSD (and I believe NetBSD as well) uses mixerctl to control your sound device(s). /etc/mixerctl.conf can be used to set default values, but typing in mixerctl outputs.master.volume=140,140 is a bit tedious.
A few textboxes and a simple shellscript make life a lot easier under Awesome.
Add the following information to your statusbar
.awesomerc additions:
textbox volDown {
mouse {
button = 1
command = "spawn"
arg = "~/.awesome/awesome-openbsd-volume down"
}
text = " - "
}
textbox volStatusMute {
text = " vol "
mouse {
button = 1
command = "spawn"
arg = "~/.awesome/awesome-openbsd-volume mute"
}
}
textbox volUp {
mouse {
button = 1
command = "spawn"
arg = "~/.awesome/awesome-openbsd-volume up"
}
text = " + "
}
Save the following shellscript somewhere appropriate and don't forget to make it executable.
Shell script :
#!/bin/sh # little shellscript to modify the mixerctl values with awesome WM # important: the name of the device you want to use. on my laptop, the speakers are #outputs.headphones, change to outputs.master or whatever according to your setup device=outputs.headphones #just as important, location of awesome-client! awClient="/usr/local/bin/awesome-client" # increment: value by which the mixerctl value will go up/down increment=10 case $1 in "up" ) #increment mixerctl "$device=+$increment" ;; "down" ) #decrement mixerctl "$device=-$increment" ;; "mute" ) #mute or unmute depending on the current value if [ `mixerctl "$device.mute"` == "$device.mute=on" ] then mixerctl "$device.mute=off" echo 0 widget_tell volStatusMute text " mute " | $awClient else mixerctl "$device.mute=on" echo 0 widget_tell volStatusMute text " unmute " | $awClient fi ;; esac