feat: set-vol notifications
This commit is contained in:
parent
e81397fec9
commit
6c072ff1db
@ -1 +1 @@
|
||||
Subproject commit cf95480e876ef7699bf08a1d02aa0ae3f4d5f353
|
||||
Subproject commit eeda94a0b5b370d837f1ba6f70c8038b3936808b
|
@ -1 +1 @@
|
||||
Subproject commit 1f6992d7d78f931120a1bb642b495ad1b9e462bf
|
||||
Subproject commit aa631e13d23ea0b0cfa72ea13411f6dbad18ecbf
|
19
bin/set-vol
19
bin/set-vol
@ -1,12 +1,20 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
SINK='@DEFAULT_AUDIO_SINK@'
|
||||
WPCUR="$(wpctl get-volume "$SINK")"
|
||||
CUR="$((10#$(tr -dc '0-9' <<< "$WPCUR")))"
|
||||
|
||||
grep -q MUTED <<< "$WPCUR" && MUTE=1 || MUTE=0
|
||||
|
||||
if [ "$1" == 'm' ]; then
|
||||
wpctl set-mute "$SINK" toggle
|
||||
if [ "$MUTE" = 1 ]; then
|
||||
wpctl set-mute "$SINK" 0
|
||||
dunstify -a 'changeVolume' -u low -i audio-volume-high -h string:x-dunst-stack-tag:vol -h int:value:"$CUR" "$CUR%"
|
||||
else
|
||||
wpctl set-mute "$SINK" 1
|
||||
dunstify -a "changeVolume" -u low -i audio-volume-muted -h string:x-dunst-stack-tag:vol "Mute"
|
||||
fi
|
||||
else
|
||||
CUR="$((10#$(wpctl get-volume "$SINK" | tr -dc '0-9')))"
|
||||
|
||||
case "${1:0:1}" in
|
||||
'') echo "$CUR"; exit ;;
|
||||
'+'|'-') CUR="$((CUR - CUR % $1 + $1))" ;;
|
||||
@ -14,7 +22,10 @@ else
|
||||
esac
|
||||
|
||||
wpctl set-volume -l 1.5 "$SINK" "$CUR%"
|
||||
wpctl set-mute "$SINK" 0
|
||||
if [ "$MUTE" = 1 ]; then
|
||||
wpctl set-mute "$SINK" 0
|
||||
fi
|
||||
dunstify -a 'changeVolume' -u low -i audio-volume-high -h string:x-dunst-stack-tag:vol -h int:value:"$CUR" "$CUR%"
|
||||
fi
|
||||
|
||||
# update sbar
|
||||
|
Loading…
Reference in New Issue
Block a user