From 97fef158db8ae3e67f8765978fad7b2b216c672f Mon Sep 17 00:00:00 2001 From: Shubham Saini Date: Tue, 24 Mar 2020 19:03:38 +0530 Subject: mihn --- polybar/.config/polybar/cmus.sh | 20 ++++++++++++++++++++ polybar/.config/polybar/config | 31 +++++++++++++++---------------- 2 files changed, 35 insertions(+), 16 deletions(-) create mode 100755 polybar/.config/polybar/cmus.sh (limited to 'polybar') 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 @@ +#!/bin/bash + +prepend_zero () { + seq -f "%02g" $1 $1 +} + +artist=$(echo -n $(cmus-remote -C status | grep "tag artist" | cut -c 12-)) + +if [[ $artist = *[!\ ]* ]]; then + 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]" +else + echo +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 font-0 = Hermit:style=medium:size=9;1 modules-left = alsa battery date time bspwm modules-center = -;modules-right = spotify mpd +modules-right = cmus tray-position = right cursor-click = pointer cursor-scroll = ns-resize @@ -143,21 +143,20 @@ format =