mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-24 18:58:33 +02:00
spotify: use playerctl instead of dbus commands
The module is still spotify-specific, but a bit less
This commit is contained in:
parent
194da94c77
commit
bff16a840a
2 changed files with 10 additions and 11 deletions
|
@ -6,6 +6,8 @@
|
||||||
-- To get the complete interface:
|
-- To get the complete interface:
|
||||||
-- mdbus2 org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2
|
-- mdbus2 org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2
|
||||||
|
|
||||||
|
-- Updated to use playerctl instead.
|
||||||
|
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local dbg = dbg
|
local dbg = dbg
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
|
@ -30,11 +32,7 @@ end
|
||||||
|
|
||||||
-- Send a command to spotify
|
-- Send a command to spotify
|
||||||
local function cmd(command)
|
local function cmd(command)
|
||||||
local client = spotify()
|
awful.util.spawn("playerctl " .. command, false)
|
||||||
if client then
|
|
||||||
awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify " ..
|
|
||||||
"/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player." .. command, false)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Show spotify
|
-- Show spotify
|
||||||
|
@ -52,27 +50,27 @@ function show()
|
||||||
end
|
end
|
||||||
|
|
||||||
function playpause()
|
function playpause()
|
||||||
cmd("PlayPause")
|
cmd("play-pause")
|
||||||
end
|
end
|
||||||
|
|
||||||
function play()
|
function play()
|
||||||
cmd("Play")
|
cmd("play")
|
||||||
end
|
end
|
||||||
|
|
||||||
function pause()
|
function pause()
|
||||||
cmd("Pause")
|
cmd("pause")
|
||||||
end
|
end
|
||||||
|
|
||||||
function stop()
|
function stop()
|
||||||
cmd("Stop")
|
cmd("stop")
|
||||||
end
|
end
|
||||||
|
|
||||||
function next()
|
function next()
|
||||||
cmd("Next")
|
cmd("next")
|
||||||
end
|
end
|
||||||
|
|
||||||
function previous()
|
function previous()
|
||||||
cmd("Previous")
|
cmd("previous")
|
||||||
end
|
end
|
||||||
|
|
||||||
function mixer()
|
function mixer()
|
||||||
|
|
|
@ -18,3 +18,4 @@ alsa-utils
|
||||||
pavucontrol
|
pavucontrol
|
||||||
pulseaudio
|
pulseaudio
|
||||||
numlockx
|
numlockx
|
||||||
|
playerctl
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue