From a4cdf15790e09ddb9abbfa2a37da44b1d8167641 Mon Sep 17 00:00:00 2001 From: Daniel Carrillo Date: Sat, 11 Nov 2023 15:05:56 +0100 Subject: [PATCH] [polybar] Update conf for compatibility with polybar 3.7.0 --- .config/polybar/bar.ini | 16 ++++---------- .config/polybar/modules.ini | 15 ++++++------- .config/polybar/scripts/polywins | 2 +- .config/polybar/scripts/spotify.py | 35 ------------------------------ 4 files changed, 12 insertions(+), 56 deletions(-) delete mode 100755 .config/polybar/scripts/spotify.py diff --git a/.config/polybar/bar.ini b/.config/polybar/bar.ini index 2cc27ff..ac41903 100644 --- a/.config/polybar/bar.ini +++ b/.config/polybar/bar.ini @@ -39,14 +39,6 @@ module-margin-right = 2 separator = dim-value = 1.0 locale = es_ES.UTF-8 -tray-position = right -tray-detached = false -tray-maxsize = 32 -tray-background = ${root.background} -tray-offset-x = 0 -tray-offset-y = 0 -tray-padding = 10 -tray-scale = 1.0 width = 100% enable-ipc = true @@ -58,18 +50,18 @@ fixed-center = true background = ${colors.background} foreground = ${colors.foreground} -font-0 = "RobotoMono Nerd Font Mono:style=Regular:size=16:antialias=true;1" +font-0 = "RobotoMono Nerd Font Mono:style=Regular:size=16:antialias=true;4" ; https://fontawesome.com/cheatsheet/free font-1 = "FontAwesome:size=16:antialias=true;2" font-2 = "Material Icons:size=16:antialias=true;1" -font-3 = "NotoSans-Regular:size=18:weight=bold:antialias=true;2" -font-4 = "NotoSans-Regular:size=28:weight=bold:antialias=true;-12" +font-3 = "NotoSans-Regular:size=18:weight=bold:antialias=true;6" +font-4 = "NotoSans-Regular:size=28:weight=bold:antialias=true;-11 font-5 = "FontAwesome:size=21:antialias=true;4" font-6 = "Font Awesome 6 Brands-Regular-400:size=32:antialias=true;1" modules-left = polywins modules-center = custom_date -modules-right = updates cpu_bar memory_bar docker vpn network_status network_usage alsa_bar +modules-right = updates cpu_bar memory_bar docker vpn network_status network_usage alsa_bar tray cursor-click = pointer cursor-scroll = ns-resize diff --git a/.config/polybar/modules.ini b/.config/polybar/modules.ini index ee6c8af..993d629 100644 --- a/.config/polybar/modules.ini +++ b/.config/polybar/modules.ini @@ -1,6 +1,6 @@ [module/windows] type = custom/text -content ="  " +label ="  " click-left = rofi -modi window -show window -theme $ROFI_THEME -show-icons -location 1 -yoffset +45 -xoffset +20 [module/mpd] @@ -98,13 +98,6 @@ type = custom/script exec = ~/.config/polybar/scripts/check_vpn interval = 5 -[module/spotify] -type = custom/script -exec = ~/.config/polybar/scripts/spotify.py -interval = 5 -format-prefix = " " -format-font = 1 - [module/date] type = internal/date interval = 1 @@ -187,3 +180,9 @@ exec = ~/.config/polybar/scripts/docker exec-if = docker ps -q interval = 10 label = "%output%" + +[module/tray] +type = internal/tray +tray-maxsize = 40 +tray-background = ${root.background} +tray-spacing = 7 diff --git a/.config/polybar/scripts/polywins b/.config/polybar/scripts/polywins index 6ac70cf..460477c 100755 --- a/.config/polybar/scripts/polywins +++ b/.config/polybar/scripts/polywins @@ -69,11 +69,11 @@ get_icon_by_name() [librewolf]= [nautilus]= [nextcloud]= + [nuclear]=󰋋 [nvim]= [seahorse]= [skype]= [slack]= - [spotify]= [spotube]=󰋋 [steam]= [telegramdesktop]= diff --git a/.config/polybar/scripts/spotify.py b/.config/polybar/scripts/spotify.py deleted file mode 100755 index 0f779e5..0000000 --- a/.config/polybar/scripts/spotify.py +++ /dev/null @@ -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()