Spotify support for polybar

This commit is contained in:
TuDatTr
2018-03-08 01:13:52 +01:00
parent e6575b94c2
commit 709020c441
8 changed files with 96 additions and 61 deletions

View File

@@ -29,16 +29,16 @@ background = #00000000
foreground = ${colors.foreground}
module-margin-left = 1
module-margin-right = 10
module-margin-right = 1
font-0 = fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1
font-3 = FontAwesome:style=Regular:pixelsize=10
modules-left = mpd
modules-center =
modules-right = xkeyboard volume xbacklight wlan eth battery
modules-left = spotify
modules-center = spotify-prev spotify-play spotify-stop spotify-next
modules-right = xkeyboard volume xbacklight wlan eth battery date
cursor-click = pointer
cursor-scroll = ns-resize
@@ -55,6 +55,7 @@ background = ${colors.background}
foreground = ${colors.foreground}
line-size = 0
line-color = ${colors.blue}
border-size = 0
@@ -71,15 +72,15 @@ font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1
font-3 = FontAwesome:style=Regular:pixelsize=10
modules-left = i3
modules-center =
modules-right = date powermenu
modules-left =
modules-center = i3
modules-right = powermenu
cursor-click = pointer
cursor-scroll = ns-resize
[module/xkeyboard]
type = internal/xkeyboard
pptype = internal/xkeyboard
blacklist-0 = num lock
format-prefix = " "
@@ -94,6 +95,37 @@ label-indicator-margin = 1
label-indicator-background = ${colors.magenta}
label-indicator-underline = ${colors.magenta}
[module/spotify]
type = custom/script
exec-if = pgrep -x spotify
exec = echo "$(playerctl metadata xesam:artist) - $(playerctl metadata xesam:title)"
[module/spotify-prev]
type = custom/script
exec-if = pgrep -x spotify
exec = echo ""
click-left = bash -c "playerctl previous"
[module/spotify-next]
type = custom/script
exec-if = pgrep -x spotify
exec = echo ""
click-left = bash -c "playerctl next"
[module/spotify-play]
type = custom/script
exec-if = pgrep -x spotify
exec = python -u /home/tuan/.scripts/spotify-play.py
tail = true
click-left = bash -c "if [ `cat /home/tuan/.scripts/playstate` = 0 ]; then echo '1'>/home/tuan/.scripts/playstate;else echo '0'>/home/tuan/.scripts/playstate;fi"
[module/spotify-stop]
type = custom/script
exec-if = pgrep -x spotify
exec = echo ""
tail = true
click-left = bash -c "playerctl stop && echo '0'>/home/tuan/.scripts/playstate"
[module/i3]
type = internal/i3
@@ -122,7 +154,7 @@ ws-icon-5 = 6;
ws-icon-6 = 7;
ws-icon-7 = 8;
ws-icon-8 = 9;
ws-icon-default = \
ws-icon-default = 
format = <label-state>
@@ -148,35 +180,6 @@ label-urgent-foreground = ${colors.black}
label-urgent-background = ${colors.red}
label-urgent-padding = 4
[module/mpd]
type = internal/mpd
format-online = <icon-prev> <icon-stop> <toggle> <icon-next> <icon-repeat> <icon-random> <bar-progress> <label-time> <label-song>
icon-prev = 
icon-stop = 
icon-play = 
icon-pause = 
icon-next = 
icon-random = 
icon-repeat = 
toggle-on-foreground =
toggle-on-background = #55
bar-progress-width = 45
bar-progress-format = %{A4:mpdseek+2: A5:mpdseek_2:}%fill%%indicator%%empty%%{A A}
bar-progress-indicator = |
bar-progress-indicator-foreground = #ff
bar-progress-indicator-font = 3
bar-progress-fill = ─
bar-progress-fill-foreground = #bb
bar-progress-fill-font = 3
bar-progress-empty = ─
bar-progress-empty-font = 3
bar-progress-empty-foreground = #44
[module/xbacklight]
type = internal/xbacklight