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
1 changed files with 38 additions and 0 deletions

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