mediactl v1.0.0
This commit is contained in:
commit
c3fd77a0a1
1 changed files with 38 additions and 0 deletions
38
mediactl
Executable file
38
mediactl
Executable 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
|
Loading…
Add table
Reference in a new issue