Added cmus support

lightmode
E. Almqvist 4 years ago
parent eb97eae176
commit 5c79f90507
  1. 21
      polybar/config
  2. 16
      polybar/scripts/cmus.sh

@ -46,7 +46,7 @@ module-margin = 1
modules-left = i3 title
modules-center = time
modules-right = pavolume date
modules-right = cmus pavolume date
#################################################################################
# MODULES #
@ -79,6 +79,25 @@ label-urgent-foreground = #000000
label-urgent-background = #bd2c40
label-urgent-padding = 1
[module/cmus]
type = custom/script
exec = ~/.config/polybar/scripts/cmus.sh
exec-if = pgrep -x cmus
interval = 1
click-left = cmus-remote --next
click-right = cmus-remote --prev
click-middle = cmus-remote --pause
scroll-up = cmus-remote --volume +5%
scroll-down = cmus-remote --volume -5%
label-font = 3
format = <label>
format-underline = ${colors.accent}
label = %output%
label-maxlen = 50
[module/pavolume]
type = custom/script
tail = true

@ -0,0 +1,16 @@
#!/bin/bash
prepend_zero () {
seq -f "%02g" $1 $1
}
artist=$(echo -n $(cmus-remote -C status | grep "tag artist" | cut -c 12-))
song=$(echo -n $(cmus-remote -C status | grep title | cut -c 11-))
position=$(cmus-remote -C status | grep position | cut -c 10-)
minutes1=$(prepend_zero $(($position / 60)))
seconds1=$(prepend_zero $(($position % 60)))
duration=$(cmus-remote -C status | grep duration | cut -c 10-)
minutes2=$(prepend_zero $(($duration / 60)))
seconds2=$(prepend_zero $(($duration % 60)))
echo -n "$artist - $song [$minutes1:$seconds1/$minutes2:$seconds2]"
Loading…
Cancel
Save