summaryrefslogtreecommitdiff
path: root/.config/qtile
diff options
context:
space:
mode:
authorThanosApollo <[email protected]>2022-11-21 22:58:20 +0200
committerThanosApollo <[email protected]>2022-11-21 22:58:20 +0200
commit1a6164c1bc81de9b4542fe33e7ff9031f02b08b0 (patch)
treea3f8a61005d41fb82d7e9e698c2ea19ae9c9fd10 /.config/qtile
parent3f4e9355cc6efdbe453cbec11f02edb322393d39 (diff)
Remove spotify-widget
Diffstat (limited to '.config/qtile')
-rw-r--r--.config/qtile/spotify_widget.py55
1 files changed, 0 insertions, 55 deletions
diff --git a/.config/qtile/spotify_widget.py b/.config/qtile/spotify_widget.py
deleted file mode 100644
index 81fd41c..0000000
--- a/.config/qtile/spotify_widget.py
+++ /dev/null
@@ -1,55 +0,0 @@
-import dbus
-import subprocess
-from functools import partial
-from libqtile.widget import base
-
-class Spotify(base.ThreadPoolText):
- """A simple Spotify widget, made using dbus-python.
- Show the song and artist of now listening song and allow basic mouse
- control from the bar using spotify-control(
- Github: https://github.com/J00LZ/spotify-control
- AUR: https://aur.archlinux.org/packages/spotify-control
- ):
- - toggle pause (or play if stopped) on left click;
- - skip forward in playlist on scroll up;
- - skip backward in playlist on scroll down.
- """
-
- defaults = [
- ("color", "00ff00", "Text"),
- ("update_interval", 0.5, "Update Time in seconds."),
- ]
-
- def __init__(self, **config):
- base.ThreadPoolText.__init__(self, "", **config)
- self.add_defaults(Spotify.defaults)
- self.local = None
- self.add_callbacks(
- {
- "Button1": partial(subprocess.Popen, ["spotify-control", "play-pause"]),
- "Button4": partial(subprocess.Popen, ["spotify-control", "next"]),
- "Button5": partial(subprocess.Popen, ["spotify-control", "previous"]),
- }
- )
-
- def now_playing(self):
- """Return current song"""
- session_bus = dbus.SessionBus()
- bus_data = ("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
- spotify_bus = session_bus.get_object(*bus_data)
- interface = dbus.Interface(spotify_bus, "org.freedesktop.DBus.Properties")
- metadata = interface.Get("org.mpris.MediaPlayer2.Player", "Metadata")
- data = {
- "artist" : next(iter(metadata.get("xesam:albumArtist"))),
- "song" : metadata.get("xesam:title")
- }
- song = data["song"] + " ♫ " + data["artist"]
- self.layout.colour = self.color
- return song
-
- def poll(self):
- """Poll content for the text box."""
- try:
- return self.now_playing()
- except :
- return "Spotify is not responding"