1
0

mediaplayer control script

This commit is contained in:
2023-11-25 19:49:02 +01:00
parent 402e2ebbfc
commit 414b04fe34
+38
View File
@@ -0,0 +1,38 @@
#!/bin/sh
case "$1" in
play-pause )
func=PlayPause
;;
next )
func=Next
;;
previous )
func=Previous
;;
play )
func=Play
;;
pause )
func=Pause
;;
stop )
func=Stop
;;
* )
exit 3
esac
# get first mpris interface
bus=$(dbus-send --session \
--dest=org.freedesktop.DBus \
--type=method_call \
--print-reply=literal \
/org/freedesktop/DBus \
org.freedesktop.DBus.ListNames |
tr ' ' '\n' |
grep 'org.mpris.MediaPlayer2' |
head -n 1)
dbus-send --type=method_call --dest=$bus /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.$func