Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Silly volume control scripts for openbox that probably won't work for everyone
Tags mpc, notify-send, volume
Code:
#!/bin/bash # volume changer+notifier, using notify-send, and tested only with xfce4-notifyd # the syntax is the same of the "end" of what you'd use in plain amixer, see "$1" # Ex.: 5%-, 5%+, 30, 60% com=(`amixer set "Master" $1`) vol1=${com[20]} # and here's why it won't work for everybody. The output of amixer includes # things like soundcard features, which are array elements I'm just skipping. # Volume happens to be the 20th for me. vol=${vol1//[^0-9]/} ((vol>0)) && lev=low ((vol>33)) && lev=medium ((vol>63)) && lev=high [[ "${com[22]}" == *off* ]] && lev=muted notify-send "Volume" -t 300 -i audio-volume-$lev -h int:value:"$vol"%
Code:
#!/bin/bash # toggles volume mute/unmute and mpc playback, if it was playing # notify-send and obmpc.sh contains also a OSD for mpc itself com=(`amixer -D pulse set "Master" toggle`) if [ -e /dev/shm/mpcpaused ] ; then mpc play && obmpc.sh osd & rm /dev/shm/mpcpaused else mpc | grep playing && ( mpc pause ; obmpc.sh osd & touch /dev/shm/mpcpaused ) fi vol1=${com[25]} vol=${vol1//[^0-9]/} ((vol>0)) && lev=low ((vol>30)) && lev=medium ((vol>60)) && lev=high [[ "${com[26]}" == *off* ]] && lev=muted notify-send "Volume" -t 1000 -i audio-volume-$lev -h int:value:"$vol"%
Total Comments 0