Update volume module to work with any default sink

This commit is contained in:
Baitinq 2021-12-14 12:22:13 +00:00 committed by GitHub
parent d68a1e3372
commit 0e8e7ab63d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,9 +6,8 @@ VOLUME_ON_ICON=''
VOLUME_MUTED_ICON='' VOLUME_MUTED_ICON=''
get_volume(){ get_volume(){
active_sink=$(pactl list short sinks | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,' | head -n 1) curStatus=$(pactl get-sink-mute @DEFAULT_SINK@)
curStatus=$(pactl get-sink-mute $active_sink) volume=$(pactl get-sink-volume @DEFAULT_SINK@ | tail -n 2 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' | head -n 1)
volume=$(pactl get-sink-volume $active_sink | tail -n 2 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' | head -n 1)
if [ "${curStatus}" = 'Mute: yes' ] if [ "${curStatus}" = 'Mute: yes' ]
then then