Add some scripts
This commit is contained in:
parent
0ec6e946f7
commit
9a48ec9810
8 changed files with 140 additions and 0 deletions
38
bin/volume.sh
Executable file
38
bin/volume.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Increment, decrement, or mute the volume using Pipewire and send a notification
|
||||
|
||||
case $1 in
|
||||
up)
|
||||
# Set the volume on (if it was muted)
|
||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
|
||||
wpctl set-volume -l 2.0 @DEFAULT_AUDIO_SINK@ 2%+
|
||||
;;
|
||||
down)
|
||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
|
||||
wpctl set-volume -l 2.0 @DEFAULT_AUDIO_SINK@ 2%-
|
||||
;;
|
||||
mute)
|
||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
||||
;;
|
||||
esac
|
||||
|
||||
VOLUME=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | tr -dc '0-9' | sed 's/^0\{1,2\}//')
|
||||
|
||||
|
||||
send_notification() {
|
||||
if [ "$1" = "mute" ]; then ICON="mute"; elif [ "$VOLUME" -lt 33 ]; then ICON="low"; elif [ "$VOLUME" -lt 66 ]; then ICON="medium"; else ICON="high"; fi
|
||||
if [ "$1" = "mute" ]; then TEXT="Currently muted"; else TEXT="Currently at ${VOLUME}%"; fi
|
||||
|
||||
dunstify -a "Volume" -r 9993 -h int:value:"$VOLUME" -i "volume-$ICON" " Volume" "$TEXT" -t 2000
|
||||
}
|
||||
|
||||
case $1 in
|
||||
mute)
|
||||
case "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" in
|
||||
*MUTED* ) send_notification mute;;
|
||||
* ) send_notification;;
|
||||
esac;;
|
||||
*)
|
||||
send_notification;;
|
||||
esac
|
Loading…
Add table
Add a link
Reference in a new issue