Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
playerctl: skip metada to control music
#!/bin/bash
set -euo pipefail
case "${1:-}" in
next)
MEMBER=Next
;;
previous)
MEMBER=Previous
;;
play)
MEMBER=Play
;;
pause)
MEMBER=Pause
;;
play-pause)
MEMBER=PlayPause
;;
*)
echo "Usage: $0 next|previous|play|pause|play-pause"
exit 1
;;
esac
exec dbus-send \
--print-reply \
--dest="org.mpris.MediaPlayer2.$(playerctl -l | head -n 1)" \
/org/mpris/MediaPlayer2 \
"org.mpris.MediaPlayer2.Player.$MEMBER"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.