mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-09 09:44:20 +02:00
Revert "spotify: try to support the new version of Spotify"
This reverts commit 6c8985a9ae
. Well, keep
old version of Spotify until MPRIS DBus support is updated.
This commit is contained in:
parent
6c8985a9ae
commit
93a5cf16ba
3 changed files with 47 additions and 60 deletions
|
@ -22,7 +22,8 @@ case "$1" in
|
|||
;;
|
||||
lock)
|
||||
# First, stop Spotify
|
||||
xdotool key XF86AudioPause
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify \
|
||||
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause
|
||||
# Then, lock screen
|
||||
i3lock_options="-e -i $HOME/.cache/awesome/current-wallpaper.png -t"
|
||||
echo "$(date --rfc-3339=seconds) $me: lock: lock screen"
|
||||
|
|
|
@ -8,67 +8,61 @@
|
|||
|
||||
local awful = require("awful")
|
||||
local pairs = pairs
|
||||
local os = os
|
||||
local capi = {
|
||||
client = client
|
||||
}
|
||||
|
||||
module("vbe/spotify")
|
||||
|
||||
-- Get spotify window
|
||||
local function 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()
|
||||
-- Play seems unable to play in many situations, let's use
|
||||
-- PlayPause instead.
|
||||
spotify("PlayPause")
|
||||
end
|
||||
|
||||
function pause()
|
||||
spotify("Pause")
|
||||
end
|
||||
|
||||
function stop()
|
||||
spotify("Stop")
|
||||
end
|
||||
|
||||
function next()
|
||||
spotify("Next")
|
||||
end
|
||||
|
||||
function previous()
|
||||
spotify("Previous")
|
||||
end
|
||||
|
||||
function show()
|
||||
-- This should work, but no:
|
||||
-- spotify("Raise")
|
||||
local clients = capi.client.get()
|
||||
for k, c in pairs(clients) do
|
||||
if awful.rules.match(c, { instance = "spotify",
|
||||
class = "Spotify" }) then
|
||||
return c
|
||||
if not c:isvisible() then
|
||||
awful.tag.viewonly(c:tags()[1])
|
||||
end
|
||||
capi.client.focus = c
|
||||
c:raise()
|
||||
return
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Send a command to spotify
|
||||
local function cmd(command)
|
||||
local client = spotify()
|
||||
if client then
|
||||
os.execute("xdotool key --window " .. client.window .. " " .. command)
|
||||
end
|
||||
end
|
||||
|
||||
-- Show spotify
|
||||
function show()
|
||||
local client = spotify()
|
||||
if client then
|
||||
if not client:isvisible() then
|
||||
awful.tag.viewonly(client:tags()[1])
|
||||
end
|
||||
capi.client.focus = client
|
||||
client:raise()
|
||||
else
|
||||
awful.util.spawn("spotify")
|
||||
end
|
||||
end
|
||||
|
||||
function playpause()
|
||||
cmd("space")
|
||||
end
|
||||
|
||||
function play()
|
||||
cmd("XF86AudioPlay")
|
||||
end
|
||||
|
||||
function pause()
|
||||
cmd("XF86AudioPause")
|
||||
end
|
||||
|
||||
function stop()
|
||||
cmd("XF86AudioStop")
|
||||
end
|
||||
|
||||
function next()
|
||||
cmd("XF86AudioNext")
|
||||
end
|
||||
|
||||
function previous()
|
||||
cmd("XF86AudioPrev")
|
||||
awful.util.spawn("spotify")
|
||||
-- To disable notifications, add the following line to
|
||||
-- ~/.config/spotify/Users/<spotifylogin>-user/prefs:
|
||||
-- ui.track_notifications_enabled=false
|
||||
end
|
||||
|
|
|
@ -43,10 +43,6 @@ shifty.config.tags = {
|
|||
screen = math.max(screen.count(), 2),
|
||||
icon = tagicon("im"),
|
||||
nopopup = true, -- don't give focus on creation
|
||||
},
|
||||
spotify = {
|
||||
screen = 1,
|
||||
exclusive = true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,10 +60,6 @@ shifty.config.apps = {
|
|||
match = { class = { "Skype", "Pidgin" } },
|
||||
tag = "im",
|
||||
},
|
||||
{
|
||||
match = { class = { "Spotify" } },
|
||||
tag = "spotify"
|
||||
},
|
||||
{
|
||||
match = { config.termclass },
|
||||
startup = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue