Add spotify now playing script to polybar

This commit is contained in:
tactonbishop 2022-06-05 18:09:13 +01:00
parent c241edbeab
commit 9659eab318
2 changed files with 38 additions and 4 deletions

View file

@ -55,9 +55,9 @@ font-2 = unicode:fontformat=truetype:size=8:antialias=false;0
font-3 = SymbolsNerdFont:size=15;3 font-3 = SymbolsNerdFont:size=15;3
modules-left = my-text-label xworkspaces modules-left = my-text-label xworkspaces nowplaying
modules-right = filesystem memory cpu battery temperature pulseaudio bluetooth wlan date modules-center =
; modules-right = xwindow filesystem pulseaudio xkeyboard memory cpu wlan eth date modules-right = filesystem memory cpu battery temperature backlight pulseaudio bluetooth wlan date
tray-position = right tray-position = right
tray-padding = 2 tray-padding = 2
@ -110,9 +110,10 @@ label-volume = %percentage%%
label-muted = "muted" label-muted = "muted"
click-right = exec pavucontrol click-right = exec pavucontrol
label-muted-foreground = ${colors.disabled} label-muted-foreground = ${colors.disabled}
label-padding = 1
format-volume-underline = #3c4812 format-volume-underline = #3c4812
format-muted-underline = ${colors.alert} format-muted-underline = ${colors.alert}
label-volume-padding = 1
[module/xkeyboard] [module/xkeyboard]
type = internal/xkeyboard type = internal/xkeyboard
blacklist-0 = num lock blacklist-0 = num lock
@ -254,8 +255,30 @@ click-left = exec ~/.config/polybar/polybar_scripts/toggle_bluetooth.sh
format-padding = 1 format-padding = 1
format-foreground = ${colors.primary} format-foreground = ${colors.primary}
format-underline = ${colors.primary} format-underline = ${colors.primary}
label-padding = 1
[module/backlight]
type = internal/xbacklight
enable-scroll = true
format = <label>
label = %percentage%%
format-prefix = " "
format-prefix-foreground = ${colors.primary}
format-underline = ${colors.primary}
label-padding = 1
[module/nowplaying]
type = custom/script
exec = ~/dotfiles/polybar/polybar_scripts/now_playing.sh
interval = 3
click-left = playerctl play-pause &
format-prefix = ""
format-prefix-foreground = ${colors.primary}
label-padding = 1
format-underline = ${colors.primary}
[settings] [settings]
screenchange-reload = true screenchange-reload = true
pseudo-transparency = true pseudo-transparency = true

View file

@ -0,0 +1,11 @@
#!/bin/sh
player_status=$(playerctl status 2> /dev/null)
if [ "$player_status" = "Playing" ]; then
echo " $(playerctl metadata artist) | $(playerctl metadata title) | $(playerctl metadata album)"
elif [ "$player_status" = "Paused" ]; then
echo " $(playerctl metadata artist) | $(playerctl metadata title) | $(playerctl metadata album)"
else
echo "$(playerctl status)"
fi