diff options
| -rw-r--r-- | i3/conkyrc.json | 12 | ||||
| -rwxr-xr-x | scripts/audio_status.sh | 38 |
2 files changed, 40 insertions, 10 deletions
diff --git a/i3/conkyrc.json b/i3/conkyrc.json index bea7884..ff2c6e2 100644 --- a/i3/conkyrc.json +++ b/i3/conkyrc.json @@ -85,16 +85,8 @@ TEXT ################ Volume ######################## - {"name": "symbol", "color": "\#ffffff", "full_text": - ${if_match "${exec pamixer --get-mute}"=="true"}"M"${else}"U"${endif}, - "separator": false}, - - {"name": "card", "color": "\#ffffff", "separator": false, - "full_text": "${exec pacmd info | grep 'Default sink' | grep -o '[^.]*$'}"}, - - {"name": "Volume", "color": "\#ffffff", "full_text": - "[${exec pamixer --get-volume}%]"}, - + {"name": "volume status", "color": "\#ffffff", "full_text": + "${exec ~/.dotfiles/scripts/audio_status.sh}"}, ################# Battery #################### diff --git a/scripts/audio_status.sh b/scripts/audio_status.sh new file mode 100755 index 0000000..84a6a01 --- /dev/null +++ b/scripts/audio_status.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +function print_mute { + echo -n "M " +} + +function print_unmute { + echo -n "U " +} + +if type pamixer &>/dev/null +then + if pamixer --get-mute &> /dev/null + then + print_mute + else + print_unmute + fi + + echo -n $(pacmd info | grep 'Default sink' | grep -o '[^.]*$') + + echo " [$(pamixer --get-volume)%]" + +elif type amixer &>/dev/null +then + if [[ "$(amixer sget Master | grep '\[on\]')" == "" ]] + then + print_mute + else + print_unmute + fi + + echo -n "Volume: " + + echo "[$(amixer sget Master | grep Mono: | sed -e 's/[ \t]*Mono: Playback [0-9]* \[\([0-9]*%\)\].*/\1/')]" +else + echo "please install either pamixer or amixer" +fi |
