From 81dabd6bcadcda3fadb5eb7fceaaaad29cefaf27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Tue, 15 Oct 2024 09:51:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(waybar):=20custom-music=20mo?= =?UTF-8?q?dule=20now=20works=20correctly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/waybar/bars/bar-1.jsonc | 4 ++-- .../{custom-media.jsonc => custom-music.jsonc} | 11 ++++------- .config/waybar/scripts/mediaplayer.py | 4 +--- .config/waybar/style.css | 4 ++-- 4 files changed, 9 insertions(+), 14 deletions(-) rename .config/waybar/modules/{custom-media.jsonc => custom-music.jsonc} (50%) diff --git a/.config/waybar/bars/bar-1.jsonc b/.config/waybar/bars/bar-1.jsonc index 8aed17c8..62c5968a 100644 --- a/.config/waybar/bars/bar-1.jsonc +++ b/.config/waybar/bars/bar-1.jsonc @@ -3,7 +3,7 @@ "~/.config/waybar/modules/custom-cava.jsonc", "~/.config/waybar/modules/custom-wf-recorder.jsonc", "~/.config/waybar/modules/custom-updates.jsonc", - "~/.config/waybar/modules/custom-media.jsonc", + "~/.config/waybar/modules/custom-music.jsonc", "~/.config/waybar/modules/custom-logo.jsonc", "~/.config/waybar/modules/custom-notifications.jsonc", "~/.config/waybar/modules/custom-weather.jsonc", @@ -18,7 +18,7 @@ "custom/cava", "custom/wf-recorder", ], - "modules-center": ["custom/media"], + "modules-center": ["custom/music"], "modules-right": [ "custom/updates", "hyprland/language", diff --git a/.config/waybar/modules/custom-media.jsonc b/.config/waybar/modules/custom-music.jsonc similarity index 50% rename from .config/waybar/modules/custom-media.jsonc rename to .config/waybar/modules/custom-music.jsonc index fae0da06..90326128 100644 --- a/.config/waybar/modules/custom-media.jsonc +++ b/.config/waybar/modules/custom-music.jsonc @@ -1,14 +1,11 @@ { - "custom/media": { - "format": "{icon} {}", + "custom/music": { + "format": "{0}", "return-type": "json", "max-length": 100, - "format-icons": { - "spotify": " ", - "default": " ", - }, "escape": true, - "exec": "$HOME/.config/waybar/scripts/mediaplayer.py 2> /dev/null", + "tooltip": true, + "exec": "~/.config/waybar/scripts/mediaplayer.py --player spotify", "on-click": "playerctl play-pause", "on-scroll-up": "playerctl next", "on-scroll-down": "playerctl previous", diff --git a/.config/waybar/scripts/mediaplayer.py b/.config/waybar/scripts/mediaplayer.py index b3f255d3..ea9b2413 100755 --- a/.config/waybar/scripts/mediaplayer.py +++ b/.config/waybar/scripts/mediaplayer.py @@ -135,9 +135,7 @@ class PlayerManager: track_info = title if track_info: - if player.props.status == "Playing": - track_info = " " + track_info - else: + if player.props.status != "Playing": track_info = " " + track_info # only print output if no other player is playing current_playing = self.get_first_playing_player() diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 0c6776ad..529431b1 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -39,7 +39,7 @@ #cpu, #memory, #temperature, -#custom-media, +#custom-music, #custom-fans, #clock, #idle_inhibitor, @@ -252,7 +252,7 @@ window#waybar.hidden { color: @mantle; } -#custom-media { +#custom-music { background: @lavender; background: linear-gradient( 52deg,