mediactl v1.0.0

This commit is contained in:
DarkCat09 2024-04-18 09:34:58 +04:00
commit c3fd77a0a1
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3

38
mediactl Executable file
View file

@ -0,0 +1,38 @@
#!/bin/sh
vol_pct=5
sink_id=$(pw-dump Node Device | sed -n "/$(pactl get-default-sink)/,/\}/p" | grep object.id | grep -o '[0-9]*')
setvol () {
wpctl set-volume "$sink_id" "${vol_pct}%$1"
}
togglemute() {
wpctl set-mute "$sink_id" toggle
}
notifyvol () {
notify-send "$(wpctl get-volume "$sink_id")"
}
case "$1" in
"volup")
setvol +
notifyvol
;;
"voldown")
setvol -
notifyvol
;;
"volmute")
togglemute
notifyvol
;;
"playpause")
notify-send "$(playerctl play-pause 2>&1)"
;;
*)
echo 'Available: volup, voldown, volmute, playpause'
;;
esac