dotfiles

:)
git clone https://git.sr.ht/~ashymad/dotfiles
Log | Files | Refs | Submodules | LICENSE

commit 71bd14651a244abd58d1a813c25e30218b0e963e
parent 166392b9c36d33ea7179ec936d82f5932781fb5f
Author: Ashymad <czilukim@o2.pl>
Date:   Wed, 16 May 2018 10:30:49 +0200

Improve cmus polybar script

Diffstat:
Mcmus/.cmus/cmus-geeqie.sh | 12++++--------
Mpolybar/.config/polybar/cmus.sh | 22++++++++++------------
2 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/cmus/.cmus/cmus-geeqie.sh b/cmus/.cmus/cmus-geeqie.sh @@ -4,13 +4,14 @@ ## There are several album art viewers for Cmus but this I believe is the most ## compatible with different setups as it is simpler. No weird hacks. -## Requires feh (light no-gui image viewer). +STATUS=$( cmus-remote -Q | tee /tmp/cmus.status) + +FOLDER=$( echo "$STATUS" | grep "file" | sed "s/file //" | rev | cut -d"/" -f2- | rev ) -FOLDER=$( cmus-remote -Q | grep "file" | sed "s/file //" | rev | \ -cut -d"/" -f2- | rev ) if [[ ${FOLDER:0:3} == "cue" ]]; then FOLDER=$(echo "$FOLDER" | sed 's/cue:\/\///g' | rev | cut -d"/" -f2- | rev) fi + FLIST=$( find "$FOLDER" -type f ) if echo "$FLIST" | grep -i ".jpeg\|.png\|.jpg" &>/dev/null; then @@ -21,12 +22,7 @@ if echo "$FLIST" | grep -i ".jpeg\|.png\|.jpg" &>/dev/null; then ART=$( echo "$FLIST" | grep -i ".png\|.jpg\|.jpeg" | head -n1 ) fi - - - # '200x200' is the window size for the artwork. '+1160+546' is the offset. - # For example, if you want a 250 by 250 window on the bottom right hand corner of a 1920 by 1080 screen: "250x250+1670+830" geeqie -r File:"$ART" else geeqie -r File:"/home/shyman/.cmus/none.jpg" - exit fi diff --git a/polybar/.config/polybar/cmus.sh b/polybar/.config/polybar/cmus.sh @@ -1,14 +1,12 @@ #!/bin/sh -if cmus-remote -C status > /tmp/cmus.status; then - - TITLE=$(grep 'tag title ' /tmp/cmus.status | tail -c +11) - ARTIST=$(grep 'tag artist ' /tmp/cmus.status | tail -c +12) - STATE=$(grep 'status ' /tmp/cmus.status | tail -c +8) - if [ $STATE = 'playing' ]; then - echo "▶ $ARTIST - $TITLE" - elif [ $STATE = 'paused' ]; then - echo "⏸ $ARTIST - $TITLE" - else - echo "■" - fi +TITLE=$(grep 'tag title ' /tmp/cmus.status | tail -c +11) +ARTIST=$(grep 'tag artist ' /tmp/cmus.status | tail -c +12) +STATE=$(grep 'status ' /tmp/cmus.status | tail -c +8) + +if [ $STATE = 'playing' ]; then + echo "▶ $ARTIST - $TITLE" +elif [ $STATE = 'paused' ]; then + echo "⏸ $ARTIST - $TITLE" +else + echo "■" fi