vincentbernat.i3wm-configur.../lib/spotify.lua
Vincent Bernat 8f6b6733bc music: abstract the functions used to control music player
We still use Spotify but we isolate the music functions into a
specific module. Other music player would implement the same
interface.
2013-11-01 15:27:56 +01:00

35 lines
572 B
Lua

-- Drive spotify
local awful = require("awful")
module("vbe/spotify")
-- Send a command to spotify
local function spotify(command)
awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify " ..
"/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player." .. command, false)
end
function playpause()
spotify("PlayPause")
end
function play()
spotify("Play")
end
function pause()
spotify("Pause")
end
function stop()
spotify("Stop")
end
function next()
spotify("Next")
end
function previous()
spotify("Previous")
end