Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # print volume (for dwm)
- volume_file=/tmp/.dwm/volume
- # Create directory if non-existing
- mkdir -p $(dirname $volume_file)
- case $1 in
- up)
- amixer -q sset Master 1+ unmute
- volume=$(amixer get Master | awk -F'[]%[]' '/%/ {if ($7 == "off") { print " M" } else { print $2 }}' )
- echo "$volume" > $volume_file
- ;;
- down)
- amixer -q sset Master 1- unmute
- volume=$(amixer get Master | awk -F'[]%[]' '/%/ {if ($7 == "off") { print " M" } else { print $2 }}' )
- echo "$volume" > $volume_file
- ;;
- mute)
- amixer -q sset Master toggle
- volume=$(amixer get Master | awk -F'[]%[]' '/%/ {if ($7 == "off") { print " M" } else { print $2 }}' )
- echo "$volume" > $volume_file
- ;;
- esac
- # Change volume in statusbar
- xsetroot -name "$(echo -e "$(cat /tmp/.dwm/ssid) $(cat /tmp/.dwm/wlan)\x03 | \x01B:$(cat /tmp/.dwm/battery)\x03 | \x01V:\x04$(cat /tmp/.dwm/volume)\x03 | \x04$(date +"%H:%M") ")"
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement