Skip to content

Instantly share code, notes, and snippets.

@tiagoamaro
Created August 14, 2019 12:48
Show Gist options
  • Save tiagoamaro/e644b50c1a40e6615291d1c9475bc803 to your computer and use it in GitHub Desktop.
Save tiagoamaro/e644b50c1a40e6615291d1c9475bc803 to your computer and use it in GitHub Desktop.
Spotify Control (Ubuntu)
#!/usr/bin/env bash
# Simple Spotify Control
# Just call ./spotify_control --help
# Source: https://community.spotify.com/t5/Desktop-Linux/Linux-keyboard-shortcuts/td-p/1626394
CMD="dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player"
case "$1" in
"playpause" )
${CMD}.PlayPause
exit $?
;;
"next" )
${CMD}.Next
exit $?
;;
"previous" )
${CMD}.Previous
exit $?
;;
"stop" )
${CMD}.Stop
exit $?
;;
"play" )
${CMD}.Play
exit $?
;;
*)
echo "Usage: $0 [command]"
echo " commands are: playpause, next, previous, stop, play"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment