You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
757 B
23 lines
757 B
2 years ago
|
#!/bin/bash
|
||
|
# chvolume
|
||
|
|
||
|
# Arbitrary but unique message tag
|
||
|
msgTag="volume-updater"
|
||
|
|
||
|
pactl set-sink-volume @DEFAULT_SINK@ "$1"
|
||
|
|
||
|
pactl set-sink-mute @DEFAULT_SINK@ "$2"
|
||
|
|
||
|
volume="$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | sed 's/[^0-9]*//g')"
|
||
|
mute="$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')"
|
||
|
|
||
|
if [[ $volume == 0 || "$mute" == "yes" ]]; then
|
||
|
# Show the sound muted notification
|
||
|
dunstify -a "chvolume" -u low -i audio-volume-muted -h string:x-dunst-stack-tag:$msgTag "Volume muted"
|
||
|
else
|
||
|
# Show the volume notification
|
||
|
dunstify -a "chvolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag \
|
||
|
-h int:value:"$volume" "Volume: ${volume}%"
|
||
|
fi
|
||
|
|
||
|
canberra-gtk-play -i audio-volume-change -d "chvolume"
|