diff options
author | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-10-21 20:09:02 +0100 |
---|---|---|
committer | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-10-21 20:09:02 +0100 |
commit | bb788dddf67c67d8ccd8f365187fea4d470a5d11 (patch) | |
tree | 94d0df9c3797db4c0df50601104b0da09b09651f /modules/volume | |
parent | 032d16e9ae83ff20bf6a6f0d474f6ff10903bb5c (diff) |
Added volume module
Diffstat (limited to 'modules/volume')
-rwxr-xr-x | modules/volume | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/volume b/modules/volume new file mode 100755 index 0000000..27bb7dd --- /dev/null +++ b/modules/volume @@ -0,0 +1,21 @@ +#!/bin/bash + +# Prints out the volume percentage + +VOLUME_ON_ICON='' +VOLUME_MUTED_ICON='' + +get_volume(){ + active_sink=$(pacmd list-sinks | awk '/* index:/{print $3}') + curStatus=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | awk '/muted/{ print $2}') + volume=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | grep 'volume:' | grep -E -v 'base volume:' | awk -F : '{print $3}' | grep -o -P '.{0,3}%'| sed s/.$// | tr -d ' ') + + if [ "${curStatus}" = 'yes' ] + then + echo "$VOLUME_MUTED_ICON $volume%" + else + echo "$VOLUME_ON_ICON $volume%" + fi +} + +get_volume |