Skip to content

Commit

Permalink
Replace spotify widget with Mpris2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigmanificient committed Sep 14, 2024
1 parent 5d78e2a commit 9ca3008
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 46 deletions.
6 changes: 3 additions & 3 deletions home/qtile/src/core/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
CPUGraph,
GroupBox,
Memory,
Mpris2,
Prompt,
QuickExit,
Separator,
SpotifyNowPlaying,
Systray,
TaskList,
)
Expand All @@ -26,7 +26,7 @@ class Bar(bar.Bar):
TaskList,
Separator,
Prompt,
SpotifyNowPlaying,
Mpris2,
Battery,
Memory,
CPUGraph,
Expand All @@ -46,7 +46,7 @@ def __init__(self, id_):
margin=[0, 0, 8, 0]
)

def is_desktop(self) -> bool:
def is_desktop(self):
machine_info = subprocess.check_output(
["hostnamectl", "status"], universal_newlines=True)
m = re.search(r"Chassis: (\w+)\s.*\n", machine_info)
Expand Down
5 changes: 2 additions & 3 deletions home/qtile/src/widgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Clock,
CPUGraph,
GroupBox,
Mpris2,
Memory,
Prompt,
QuickExit,
Expand All @@ -12,19 +13,17 @@
Systray
)

from .spotify import SpotifyNowPlaying

__all__ = (
"widget_defaults",
"Battery",
"Clock",
"CPUGraph",
"GroupBox",
"Mpris2",
"Memory",
"Prompt",
"QuickExit",
"Separator",
"SpotifyNowPlaying",
"TaskList",
"Systray",
)
6 changes: 6 additions & 0 deletions home/qtile/src/widgets/overides.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def mk_overrides(cls, **conf):
active=Color.TEXT_LIGHT,
)

Mpris2 = mk_overrides(
widget.Mpris2,
objname="org.mpris.MediaPlayer2.spotify",
format='{xesam:title} - {xesam:artist}',
)

Memory = mk_overrides(
widget.Memory,
format="{MemUsed: .3f}Mb",
Expand Down
40 changes: 0 additions & 40 deletions home/qtile/src/widgets/spotify.py

This file was deleted.

0 comments on commit 9ca3008

Please sign in to comment.