From 54182116654551a58cf85d434d0e8cb0a1b66eb7 Mon Sep 17 00:00:00 2001 From: Aditya Date: Wed, 1 Mar 2023 14:07:26 +0530 Subject: [PATCH] use alsa to get volume level --- modules/volume | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/volume b/modules/volume index 6b5b96e..484a6d7 100755 --- a/modules/volume +++ b/modules/volume @@ -6,14 +6,14 @@ VOLUME_ON_ICON='' VOLUME_MUTED_ICON='' get_volume(){ - curStatus=$(pactl get-sink-mute @DEFAULT_SINK@) - volume=$(pactl get-sink-volume @DEFAULT_SINK@ | tail -n 2 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' | head -n 1) + #curStatus=$(pactl get-sink-mute @DEFAULT_SINK@) + volume=$(awk -F"[][]" '/Left:/ { print $2 }' <(amixer sget Master)) - if [ "${curStatus}" = 'Mute: yes' ] + if [ "${curStatus}" = '0%' ] then - echo "$VOLUME_MUTED_ICON $volume%" + echo "$VOLUME_MUTED_ICON $volume" else - echo "$VOLUME_ON_ICON $volume%" + echo "$VOLUME_ON_ICON $volume" fi }