OpenBSD Volume Control Widget

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 : device=outputs.headphones awClient="/usr/local/bin/awesome-client" 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
 * 1) !/bin/sh
 * 2) little shellscript to modify the mixerctl values with awesome WM
 * 1) important: the name of the device you want to use. on my laptop, the speakers are
 * 2) outputs.headphones, change to outputs.master or whatever according to your setup
 * 1) just as important, location of awesome-client!
 * 1) increment: value by which the mixerctl value will go up/down