Updated polybar with my own music script

This commit is contained in:
Michał Gdula 2022-08-25 13:36:36 +01:00
parent ea4e3a6be9
commit d8be95b8d2
8 changed files with 31 additions and 32 deletions

View file

@ -44,7 +44,7 @@ cursor-scroll = ns-resize
background = ${colors.background} background = ${colors.background}
foreground = ${colors.foreground} foreground = ${colors.foreground}
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
;; FONTS ;; FONTS
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
@ -58,7 +58,7 @@ font-3 = Material:size=13;1
;; BAR SETUP ;; BAR SETUP
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
modules-left = left date left1 time left2 servers left3 modules-left = left date left1 time left2 servers left3
modules-center = center spotify center1 modules-center = music
modules-right = right dnd updates network bluetooth right1 volume right2 power right3 modules-right = right dnd updates network bluetooth right1 volume right2 power right3
;; Theres also dnd and mic modules that I don't use so much ;; Theres also dnd and mic modules that I don't use so much

View file

@ -26,22 +26,6 @@ content-foreground = ${colors.modback}
content = "%{T2}%{T-}" content = "%{T2}%{T-}"
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
;; CENTER
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
[module/center]
type = custom/text
content-background = ${colors.background}
content-foreground = ${colors.modback}
content = "%{T2}%{T-}"
[module/center1]
type = custom/text
content-background = ${colors.background}
content-foreground = ${colors.modback}
content = "%{T2}%{T-}"
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
;; RIGHT ;; RIGHT
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

0
polybar/scripts/dnd.sh Normal file → Executable file
View file

20
polybar/scripts/music.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/sh
player=$(playerctl -p %any,firefox status)
title=$(playerctl -p %any,firefox metadata --format '{{ title }}')
artist=$(playerctl -p %any,firefox metadata --format '{{ artist }}')
if [ $player = "Playing" ]
then
if [ "$title" == "" ]
then
$title="Unknow title"
fi
if [ "$artist" == "" ]
then
$artist = "Unknow artist"
fi
echo "%{F#151515}%{T2}%{T- F-}%{B#151515}"$title", "$artist"%{B-}%{F#151515}%{T2}%{T- F-}"
#else
# echo ""
fi

0
polybar/scripts/toggle_dnd.sh Normal file → Executable file
View file

0
polybar/scripts/update_check.sh Normal file → Executable file
View file

View file

@ -40,22 +40,17 @@ exec = ~/.config/polybar/scripts/server_status.sh
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
;; SPOTIFY ;; MUSIC
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
[module/spotify] [module/music]
type = custom/script type = custom/script
interval = 1 interval = 1
format = <label> exec = bash ~/.config/polybar/scripts/music.sh
format-background = ${colors.modback}
format-foreground = ${colors.foreground}
exec = python ~/.config/polybar/scripts -f "{song} | {artist}" -t 69
click-left = playerctl --player=spotify play-pause
scroll-up = playerctl --player=spotify next
scroll-down = playerctl --player=spotify previous
click-left = playerctl play-pause -i firefox
scroll-up = playerctl next -i firefox
scroll-down = playerctl previous -i firefox
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
;; DND ;; DND

View file

@ -111,9 +111,9 @@ application_spawns = [
] ]
mediactl = [ mediactl = [
EzKey("<XF86AudioPlay>", lazy.spawn("playerctl play-pause")), EzKey("<XF86AudioPlay>", lazy.spawn("playerctl play-pause -i firefox")),
EzKey("<XF86AudioNext>", lazy.spawn("playerctl next")), EzKey("<XF86AudioNext>", lazy.spawn("playerctl next -i firefox")),
EzKey("<XF86AudioPrev>", lazy.spawn("playerctl previous")), EzKey("<XF86AudioPrev>", lazy.spawn("playerctl previous -i firefox")),
] ]
scrcap = [ scrcap = [