🐛 fix(waybar): custom-music module now works correctly

This commit is contained in:
Sergio Laín 2024-10-15 09:51:01 +02:00
parent c0b455bb06
commit 81dabd6bca
No known key found for this signature in database
GPG key ID: 51BB28D8B42FB438
4 changed files with 9 additions and 14 deletions

View file

@ -3,7 +3,7 @@
"~/.config/waybar/modules/custom-cava.jsonc", "~/.config/waybar/modules/custom-cava.jsonc",
"~/.config/waybar/modules/custom-wf-recorder.jsonc", "~/.config/waybar/modules/custom-wf-recorder.jsonc",
"~/.config/waybar/modules/custom-updates.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-logo.jsonc",
"~/.config/waybar/modules/custom-notifications.jsonc", "~/.config/waybar/modules/custom-notifications.jsonc",
"~/.config/waybar/modules/custom-weather.jsonc", "~/.config/waybar/modules/custom-weather.jsonc",
@ -18,7 +18,7 @@
"custom/cava", "custom/cava",
"custom/wf-recorder", "custom/wf-recorder",
], ],
"modules-center": ["custom/media"], "modules-center": ["custom/music"],
"modules-right": [ "modules-right": [
"custom/updates", "custom/updates",
"hyprland/language", "hyprland/language",

View file

@ -1,14 +1,11 @@
{ {
"custom/media": { "custom/music": {
"format": "{icon} {}", "format": "{0}",
"return-type": "json", "return-type": "json",
"max-length": 100, "max-length": 100,
"format-icons": {
"spotify": " ",
"default": " ",
},
"escape": true, "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-click": "playerctl play-pause",
"on-scroll-up": "playerctl next", "on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous", "on-scroll-down": "playerctl previous",

View file

@ -135,9 +135,7 @@ class PlayerManager:
track_info = title track_info = title
if track_info: if track_info:
if player.props.status == "Playing": if player.props.status != "Playing":
track_info = "" + track_info
else:
track_info = "" + track_info track_info = "" + track_info
# only print output if no other player is playing # only print output if no other player is playing
current_playing = self.get_first_playing_player() current_playing = self.get_first_playing_player()

View file

@ -39,7 +39,7 @@
#cpu, #cpu,
#memory, #memory,
#temperature, #temperature,
#custom-media, #custom-music,
#custom-fans, #custom-fans,
#clock, #clock,
#idle_inhibitor, #idle_inhibitor,
@ -252,7 +252,7 @@ window#waybar.hidden {
color: @mantle; color: @mantle;
} }
#custom-media { #custom-music {
background: @lavender; background: @lavender;
background: linear-gradient( background: linear-gradient(
52deg, 52deg,