Configure spotifyd waybar
This commit is contained in:
parent
5a00da9239
commit
c2e851fbcf
5 changed files with 80 additions and 21 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
__pycache__/
|
||||
*.pyc
|
||||
.codex/
|
||||
|
|
|
|||
|
|
@ -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} ",
|
||||
|
|
|
|||
26
configs/waybar/spotify_status.sh
Normal file
26
configs/waybar/spotify_status.sh
Normal 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
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -311,6 +311,37 @@
|
|||
source = ../configs/waybar/air_control.py;
|
||||
executable = true;
|
||||
};
|
||||
".config/waybar/spotify_status.sh" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/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
|
||||
'';
|
||||
};
|
||||
".config/waybar/launch.sh" = {
|
||||
source = ../configs/waybar/launch.sh;
|
||||
executable = true;
|
||||
|
|
@ -371,6 +402,14 @@
|
|||
fi
|
||||
'';
|
||||
|
||||
services.spotifyd = {
|
||||
enable = true;
|
||||
settings.global = {
|
||||
backend = "pulseaudio";
|
||||
use_mpris = true;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.openclaw-gateway = {
|
||||
Service.EnvironmentFile =
|
||||
"${config.home.homeDirectory}/.config/openclaw/gateway.env";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue