Created
October 8, 2013 21:31
-
-
Save aziem/6892101 to your computer and use it in GitHub Desktop.
Basic elisp to control Spotify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun spotify-play () "Play Spotify" (interactive) | |
(shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Play")) | |
(defun spotify-pause () "Pause Spotify" (interactive) | |
(shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause")) | |
(defun spotify-playpause () "Play/Pause Spotify" (interactive) | |
(shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause")) | |
(defun spotify-next () "Next song in Spotify" (interactive) | |
(shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next")) | |
(defun spotify-previous () "Previous song in Spotify" (interactive) | |
(progn (shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous") | |
(sit-for 0.1) | |
(shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous"))) | |
(global-set-key (kbd "C-c <C-S-right>") 'spotify-next) | |
(global-set-key (kbd "C-c <C-S-left>") 'spotify-previous) | |
(global-set-key (kbd "C-c <C-S-up>") 'spotify-playpause) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment