aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBaitinq <30861839+Baitinq@users.noreply.github.com>2021-12-07 23:13:55 +0000
committerGitHub <noreply@github.com>2021-12-07 23:13:55 +0000
commitd68a1e337236fe00cb0390501412ad3d34b0f5a5 (patch)
tree2715a60d911b6b258186c143e0b49084a0371d9b /modules
parent36382a2604a4b12cfffb748bbfc2b0080f0e635b (diff)
Update volume module to work with pactl
Diffstat (limited to 'modules')
-rwxr-xr-xmodules/volume8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/volume b/modules/volume
index f9ba74e..f09e5a6 100755
--- a/modules/volume
+++ b/modules/volume
@@ -6,11 +6,11 @@ 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 ' ')
+ active_sink=$(pactl list short sinks | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,' | head -n 1)
+ curStatus=$(pactl get-sink-mute $active_sink)
+ volume=$(pactl get-sink-volume $active_sink | tail -n 2 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' | head -n 1)
- if [ "${curStatus}" = 'yes' ]
+ if [ "${curStatus}" = 'Mute: yes' ]
then
echo "$VOLUME_MUTED_ICON $volume%"
else