Created
August 6, 2011 23:05
-
-
Save mattdeboard/1129862 to your computer and use it in GitHub Desktop.
Small minor mode to control spotify from emacs
This file contains hidden or 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
;;Small minor mode to control spotify from emacs | |
(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-back () "Starts the song over in Spotify" (interactive) | |
(shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous")) | |
(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
Awesome!