Configure spotifyd waybar

This commit is contained in:
ltadeu6 2026-04-19 12:50:55 -03:00
parent 5a00da9239
commit c2e851fbcf
5 changed files with 80 additions and 21 deletions

View file

@ -9,7 +9,7 @@
"modules-left": ["hyprland/workspaces", "cava"],
"modules-center": ["custom/ac", "clock"],
"modules-right": [
"mpris",
"custom/spotify",
"network",
"bluetooth",
"pulseaudio",
@ -152,23 +152,16 @@
"scroll-step": 5,
"format-icons": ["󰃛", "󰃜", "󰃝", "󰃞", "󰃟", "󰃠"]
},
"mpris": {
"format": "{player_icon} {dynamic}",
"format-paused": "{status_icon} {dynamic}",
"tooltip-format": "{status_icon} {dynamic}",
"player-icons": {
"default": "",
"mpv": "🎵"
},
"status-icons": {
"paused": ""
},
"dynamic-len": 40,
"dynamic-order": ["title", "artist", "album"],
"player": "spotify",
"ignored-players": ["firefox*"],
"on-scroll-up": "playerctl -i firefox volume 0.1+",
"on-scroll-down": "playerctl -i firefox volume 0.1-"
"custom/spotify": {
"exec": "~/.config/waybar/spotify_status.sh",
"interval": 2,
"format": "{}",
"return-type": "text",
"on-click": "playerctl -p $(playerctl -l | rg '^spotifyd\\.instance' -m1) play-pause",
"on-click-middle": "playerctl -p $(playerctl -l | rg '^spotifyd\\.instance' -m1) previous",
"on-click-right": "playerctl -p $(playerctl -l | rg '^spotifyd\\.instance' -m1) next",
"on-scroll-up": "playerctl -p $(playerctl -l | rg '^spotifyd\\.instance' -m1) volume 0.1+",
"on-scroll-down": "playerctl -p $(playerctl -l | rg '^spotifyd\\.instance' -m1) volume 0.1-"
},
"battery": {
"format": "{icon} ",

View file

@ -0,0 +1,26 @@
#!/usr/bin/env sh
player="$(playerctl -l 2>/dev/null | rg '^spotifyd\.instance' -m1 || true)"
if [ -z "$player" ]; then
exit 0
fi
status="$(playerctl -p "$player" status 2>/dev/null || true)"
text="$(playerctl -p "$player" metadata --format '{{artist}} - {{title}}' 2>/dev/null || true)"
if [ -z "$text" ]; then
exit 0
fi
case "$status" in
Playing)
printf ' %s\n' "$text"
;;
Paused)
printf ' %s\n' "$text"
;;
*)
exit 0
;;
esac

View file

@ -42,7 +42,7 @@
#custom-exit,
#custom-sleep,
#custom-poweroff,
#mpris,
#custom-spotify,
#battery,
#pulseaudio,
#bluetooth,
@ -50,7 +50,7 @@
#network {
padding: 0 1rem;
}
#mpris {
#custom-spotify {
font-family: "GohuFont 11 Nerd Font Mono";
font-weight: 700;
letter-spacing: 1.5px;
@ -71,7 +71,7 @@
}
#custom-exit,
#mpris,
#custom-spotify,
#pulseaudio,
#backlight {
color: @yellow;