From 24edb4f5cb9113b0ab57a3c4d6264fc7df7da9fc Mon Sep 17 00:00:00 2001 From: TiredSounds Date: Tue, 16 Jun 2015 10:25:40 +0100 Subject: [PATCH] Create cmus-conky-timebar.sh --- cmus-conky-timebar.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cmus-conky-timebar.sh diff --git a/cmus-conky-timebar.sh b/cmus-conky-timebar.sh new file mode 100644 index 0000000..61f524a --- /dev/null +++ b/cmus-conky-timebar.sh @@ -0,0 +1,12 @@ +#!/bin/bash +## Gets current track time for a bar in Conky. +## Usage: Put ${execbar /path/to/script} in your .conkyrc. +## It might be useful to use ${goto x} or ${voffset x} to adjust position, and ${color #xxxxxx} for color. +## The 'default_bar_size x y' option can be used before the TEXT section in your .conkyrc to adjust height and width. +## Requires 'bc' for calculating percentage. + +if cmus-remote -Q &>/dev/null ; then + DUR=$( cmus-remote -Q | grep "duration" | cut -c10- ) + POS=$( cmus-remote -Q | grep "position" | cut -c10- ) + echo "($POS/$DUR)*100" | bc -l +fi