summaryrefslogtreecommitdiff
path: root/polybar
diff options
context:
space:
mode:
authorShubham Saini <shubham6405@gmail.com>2020-03-24 13:33:38 +0000
committerShubham Saini <shubham6405@gmail.com>2020-03-24 13:33:38 +0000
commit97fef158db8ae3e67f8765978fad7b2b216c672f (patch)
treeee25f2060d9ba99eb1ec4657e0609ff03cc4660c /polybar
parentf334accc03076837c24e31b790c638c1d7ccf4d6 (diff)
mihn
Diffstat (limited to 'polybar')
-rwxr-xr-xpolybar/.config/polybar/cmus.sh20
-rw-r--r--polybar/.config/polybar/config31
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
3prepend_zero () {
4 seq -f "%02g" $1 $1
5}
6
7artist=$(echo -n $(cmus-remote -C status | grep "tag artist" | cut -c 12-))
8
9if [[ $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]"
18else
19 echo
20fi
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
34font-0 = Hermit:style=medium:size=9;1 34font-0 = Hermit:style=medium:size=9;1
35modules-left = alsa battery date time bspwm 35modules-left = alsa battery date time bspwm
36modules-center = 36modules-center =
37;modules-right = spotify mpd 37modules-right = cmus
38tray-position = right 38tray-position = right
39cursor-click = pointer 39cursor-click = pointer
40cursor-scroll = ns-resize 40cursor-scroll = ns-resize
@@ -143,21 +143,20 @@ format = <label>
143format-foreground = #7b8c58 143format-foreground = #7b8c58
144exec = python ~/.config/polybar/spotify.py -f '{artist}: {song}' 144exec = python ~/.config/polybar/spotify.py -f '{artist}: {song}'
145 145
146;[module/cmus] 146[module/cmus]
147;type = custom/script 147type = custom/script
148;exec = ~/.config/polybar/cmus.sh 148exec = ~/.config/polybar/cmus.sh
149;exec-if = pgrep -x cmus 149exec-if = pgrep -x cmus
150;interval = 1 150interval = 1
151;click-left = cmus-remote --next 151click-left = cmus-remote --next
152;click-right = cmus-remote --prev 152click-right = cmus-remote --prev
153;click-middle = cmus-remote --pause 153click-middle = cmus-remote --pause
154;scroll-up = cmus-remote --volume +5% 154scroll-up = cmus-remote --volume +5%
155;scroll-down = cmus-remote --volume -5% 155scroll-down = cmus-remote --volume -5%
156;format = <label> 156format = mus: <label>
157;format-prefix = " " 157format-foreground = #7b8c58
158;format-foreground = #7b8c58 158label = %output%
159;label = %output% 159label-maxlen = 50
160;label-maxlen = 50
161 160
162[module/mpd] 161[module/mpd]
163type = internal/mpd 162type = internal/mpd