spotify script for poly bar

nvim
spinach 2 years ago
parent 4db6864906
commit b0e5903679

@ -4,3 +4,5 @@ rofi
mpv mpv
mpd mpd
mpc mpc
playerctl
zscroll-git

@ -0,0 +1,22 @@
#!/usr/bin/env bash
WM_DESKTOP=$(xdotool getwindowfocus)
if [[ $WM_DESKTOP == "4194404" ]] ; then
echo ""
else
WM_CLASS=$(xprop -id "$WM_DESKTOP" WM_CLASS | awk 'NF {print $NF}' | sed 's/"//g')
WM_NAME=$(xprop -id "$WM_DESKTOP" WM_NAME | cut -d '=' -f 2 | awk -F '"' '{print $2}')
# filtering
if [ "$WM_NAME" == "tmux" ] ; then
echo "tmux"
elif [ "$WM_CLASS" == "st-256color" ] ; then
echo "st"
elif [ "$WM_CLASS" == "Brave-browser" ] ; then
echo "Brave"
else
echo "$WM_NAME"
fi
fi

@ -0,0 +1,18 @@
#!/usr/bin/env bash
if [[ "$1" == "--toggle" ]] ; then
playerctl play-pause
fi
if [[ "$1" == "--scroll" ]] ; then
zscroll -l $2 \
-p " 󰎈 " \
--delay 0.5 \
--update-check true \
--match-command "playerctl status" \
--match-text "Playing" "--scroll 1" \
--match-text "Paused" "--scroll 0" \
"playerctl metadata --format '{{artist}} - {{title}}'" &
wait
fi

@ -1 +1 @@
Subproject commit 63e79baca1c645ab6997fbc9f04ef0ecdda29645 Subproject commit 582ceb4b14d1aaf9b0a52c7f4ede68ea29c85416

@ -13,6 +13,8 @@ width = 100%
radius = 5 radius = 5
; font ; font
font-0 = Hack Nerd Font;2 font-0 = Hack Nerd Font;2
; ipc
enable-ipc = true
; seperator ; seperator
separator = | separator = |
separator-foreground = ${colors.disabled} separator-foreground = ${colors.disabled}
@ -33,7 +35,7 @@ foreground = ${colors.foreground}
inherit = section/base-bar inherit = section/base-bar
height = 16pt height = 16pt
; modules ; modules
modules-left = xworkspaces xwindow-thinkpad weather-thinkpad modules-left = xworkspaces focus weather-thinkpad
modules-right = battery pulseaudio memory cpu wlan seafile date powermenu modules-right = battery pulseaudio memory cpu wlan seafile date powermenu
[bar/desktop-bar] [bar/desktop-bar]
@ -42,11 +44,9 @@ inherit = section/base-bar
; height ; height
height = 24pt height = 24pt
; modules ; modules
modules-left = xworkspaces xwindow-desktop modules-left = xworkspaces focus spotify spotify-len
modules-center = weather-desktop modules-center = weather-desktop
modules-right = pulseaudio memory cpu eth seafile date powermenu modules-right = pulseaudio memory cpu temperature eth seafile date powermenu
[module/xworkspaces] [module/xworkspaces]
type = internal/xworkspaces type = internal/xworkspaces
@ -66,16 +66,13 @@ label-urgent-padding = 1
label-empty = %name% label-empty = %name%
label-empty-foreground = ${colors.disabled} label-empty-foreground = ${colors.disabled}
label-empty-padding = 1 label-empty-padding = 1
format = <label-state>
[module/xwindow-thinkpad] [module/focus]
; correct title size
type = internal/xwindow
label = %title:0:20:...%
[module/xwindow-desktop]
; correct title size ; correct title size
type = internal/xwindow type = custom/script
label = %title:0:40:...% interval = 0
exec = ~/.dotfiles/bin/focus_class
[module/pulseaudio] [module/pulseaudio]
type = internal/pulseaudio type = internal/pulseaudio
@ -148,6 +145,13 @@ format-prefix = "CPU "
format-prefix-foreground = ${colors.primary} format-prefix-foreground = ${colors.primary}
label = %percentage%% label = %percentage%%
[module/temperature]
type = internal/temperature
format-prefix = "TEMP "
format-prefix-foreground = ${colors.primary}
units = true
label = %temperature-c%
[network-base] [network-base]
type = internal/network type = internal/network
interval = 5 interval = 5
@ -189,5 +193,26 @@ content = %{F#F30} 
click-left = rofi-powermenu click-left = rofi-powermenu
[module/spotify]
; playerctl interaction for spotify
type = custom/script
tail = true
; spotify logo
format-prefix = " "
format-prefix-foreground = "#1ed760"
exec = poly_spotify --scroll 20
click-left = poly_spotify --toggle
click-right = rofi-music
[module/spotify-len]
; playerctl interaction for spotify
type = custom/script
tail = true
interval = 1
exec = playerctl metadata --format '{{duration(position)}}/{{duration(mpris:length)}}'
[settings] [settings]
screenchange-reload = true screenchange-reload = true

@ -1 +1 @@
Subproject commit 0786c86b63dd66ae345ed51c79d46f427522dd08 Subproject commit 692d5ef4bd5b9bd06126221cd1e895938166d183

@ -7,6 +7,7 @@
- link: - link:
~/.local/bin/ssh_agent_check: bin/ssh_agent_check ~/.local/bin/ssh_agent_check: bin/ssh_agent_check
~/.local/bin/poly_spotify: bin/poly_spotify
~/.local/bin/display_uptime: bin/display_uptime ~/.local/bin/display_uptime: bin/display_uptime
~/.local/bin/docker_check: bin/docker_check ~/.local/bin/docker_check: bin/docker_check
~/.local/bin/seafile_check: bin/seafile_check ~/.local/bin/seafile_check: bin/seafile_check

@ -1 +1 @@
Subproject commit 6ea38b44384e7a09a3863465dc3cc7b93cd7e781 Subproject commit 96c3de12eb717e33b175fd01a9aaaac84ea8d6af
Loading…
Cancel
Save