mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2025-07-01 22:09:25 +00:00
[polybar] Update conf for compatibility with polybar 3.7.0
This commit is contained in:
@ -69,11 +69,11 @@ get_icon_by_name()
|
||||
[librewolf]=
|
||||
[nautilus]=
|
||||
[nextcloud]=
|
||||
[nuclear]=
|
||||
[nvim]=
|
||||
[seahorse]=
|
||||
[skype]=
|
||||
[slack]=
|
||||
[spotify]=
|
||||
[spotube]=
|
||||
[steam]=
|
||||
[telegramdesktop]=
|
||||
|
@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import dbus
|
||||
|
||||
bus_name = 'org.mpris.MediaPlayer2.spotify'
|
||||
|
||||
|
||||
def get_spotify_song():
|
||||
output = ''
|
||||
|
||||
try:
|
||||
session_bus = dbus.SessionBus()
|
||||
spotify_bus = session_bus.get_object(bus_name, '/org/mpris/MediaPlayer2')
|
||||
spotify_properties = dbus.Interface(spotify_bus, 'org.freedesktop.DBus.Properties')
|
||||
metadata = spotify_properties.Get("org.mpris.MediaPlayer2.Player", "Metadata")
|
||||
|
||||
artist = metadata['xesam:artist'][0]
|
||||
title = metadata['xesam:title']
|
||||
|
||||
window_title = artist + ' - ' + title
|
||||
|
||||
output = "%{A1:$WM_CONTROL '" + window_title + "' &:}" + window_title + "%{A}"
|
||||
except dbus.DBusException as e:
|
||||
if (e.get_dbus_message() == f'The name {bus_name} was not provided by any .service files'):
|
||||
pass
|
||||
else:
|
||||
output = e.get_dbus_message()
|
||||
except Exception as e:
|
||||
output = str(e)
|
||||
|
||||
print(output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_spotify_song()
|
Reference in New Issue
Block a user