Skip to content

Instantly share code, notes, and snippets.

@arafatamim
Last active February 10, 2022 09:24
Show Gist options
  • Save arafatamim/90f5669769f704203e7867d671910db0 to your computer and use it in GitHub Desktop.
Save arafatamim/90f5669769f704203e7867d671910db0 to your computer and use it in GitHub Desktop.
MPRIS commands using dbus-send & busctl
#!/usr/bin/env sh
# API Reference: https://specifications.freedesktop.org/mpris-spec/2.2/Player_Interface.html
# (property) Get volume
dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.cmus \
/org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get \
string:'org.mpris.MediaPlayer2.Player' \
string:'Volume'
busctl --user get-property org.mpris.MediaPlayer2.cmus \
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player Volume
# (method) Play/pause track
dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.cmus \
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
busctl --user call org.mpris.MediaPlayer2.cmus \
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player PlayPause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment