diff options
Diffstat (limited to 'polybar')
| -rwxr-xr-x | polybar/.config/polybar/cmus.sh | 20 | ||||
| -rw-r--r-- | polybar/.config/polybar/config | 31 |
2 files changed, 35 insertions, 16 deletions
diff --git a/polybar/.config/polybar/cmus.sh b/polybar/.config/polybar/cmus.sh new file mode 100755 index 0000000..7917d4c --- /dev/null +++ b/polybar/.config/polybar/cmus.sh | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | prepend_zero () { | ||
| 4 | seq -f "%02g" $1 $1 | ||
| 5 | } | ||
| 6 | |||
| 7 | artist=$(echo -n $(cmus-remote -C status | grep "tag artist" | cut -c 12-)) | ||
| 8 | |||
| 9 | if [[ $artist = *[!\ ]* ]]; then | ||
| 10 | song=$(echo -n $(cmus-remote -C status | grep title | cut -c 11-)) | ||
| 11 | position=$(cmus-remote -C status | grep position | cut -c 10-) | ||
| 12 | minutes1=$(prepend_zero $(($position / 60))) | ||
| 13 | seconds1=$(prepend_zero $(($position % 60))) | ||
| 14 | duration=$(cmus-remote -C status | grep duration | cut -c 10-) | ||
| 15 | minutes2=$(prepend_zero $(($duration / 60))) | ||
| 16 | seconds2=$(prepend_zero $(($duration % 60))) | ||
| 17 | echo -n "$artist - $song [$minutes1:$seconds1/$minutes2:$seconds2]" | ||
| 18 | else | ||
| 19 | echo | ||
| 20 | fi | ||
diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index fa869f3..1e91738 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config | |||
| @@ -34,7 +34,7 @@ module-margin-right = 1.5 | |||
| 34 | font-0 = Hermit:style=medium:size=9;1 | 34 | font-0 = Hermit:style=medium:size=9;1 |
| 35 | modules-left = alsa battery date time bspwm | 35 | modules-left = alsa battery date time bspwm |
| 36 | modules-center = | 36 | modules-center = |
| 37 | ;modules-right = spotify mpd | 37 | modules-right = cmus |
| 38 | tray-position = right | 38 | tray-position = right |
| 39 | cursor-click = pointer | 39 | cursor-click = pointer |
| 40 | cursor-scroll = ns-resize | 40 | cursor-scroll = ns-resize |
| @@ -143,21 +143,20 @@ format = <label> | |||
| 143 | format-foreground = #7b8c58 | 143 | format-foreground = #7b8c58 |
| 144 | exec = python ~/.config/polybar/spotify.py -f '{artist}: {song}' | 144 | exec = python ~/.config/polybar/spotify.py -f '{artist}: {song}' |
| 145 | 145 | ||
| 146 | ;[module/cmus] | 146 | [module/cmus] |
| 147 | ;type = custom/script | 147 | type = custom/script |
| 148 | ;exec = ~/.config/polybar/cmus.sh | 148 | exec = ~/.config/polybar/cmus.sh |
| 149 | ;exec-if = pgrep -x cmus | 149 | exec-if = pgrep -x cmus |
| 150 | ;interval = 1 | 150 | interval = 1 |
| 151 | ;click-left = cmus-remote --next | 151 | click-left = cmus-remote --next |
| 152 | ;click-right = cmus-remote --prev | 152 | click-right = cmus-remote --prev |
| 153 | ;click-middle = cmus-remote --pause | 153 | click-middle = cmus-remote --pause |
| 154 | ;scroll-up = cmus-remote --volume +5% | 154 | scroll-up = cmus-remote --volume +5% |
| 155 | ;scroll-down = cmus-remote --volume -5% | 155 | scroll-down = cmus-remote --volume -5% |
| 156 | ;format = <label> | 156 | format = mus: <label> |
| 157 | ;format-prefix = " " | 157 | format-foreground = #7b8c58 |
| 158 | ;format-foreground = #7b8c58 | 158 | label = %output% |
| 159 | ;label = %output% | 159 | label-maxlen = 50 |
| 160 | ;label-maxlen = 50 | ||
| 161 | 160 | ||
| 162 | [module/mpd] | 161 | [module/mpd] |
| 163 | type = internal/mpd | 162 | type = internal/mpd |
