diff options
Diffstat (limited to 'scripts/scripts/cmusnp.sh')
-rwxr-xr-x | scripts/scripts/cmusnp.sh | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/scripts/scripts/cmusnp.sh b/scripts/scripts/cmusnp.sh deleted file mode 100755 index b43c7e8..0000000 --- a/scripts/scripts/cmusnp.sh +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # Display currently playing song from cmus | ||
3 | # Requires cmus | ||
4 | |||
5 | # colors | ||
6 | active="$( ~/scripts/get_xres color7 )" | ||
7 | inactive="$( ~/scripts/get_xres color7 )" | ||
8 | |||
9 | np_string="" | ||
10 | |||
11 | trunc() { | ||
12 | max_length=$1 | ||
13 | text=$2 | ||
14 | length=${#text} | ||
15 | (( length > max_length )) && | ||
16 | text=${text::$(( max_length ))}... | ||
17 | echo "$text" | ||
18 | } | ||
19 | |||
20 | if pgrep -x "cmus" > /dev/null | ||
21 | then | ||
22 | status=$( cmus-remote -Q | grep status\ | sed 's/status //' ) | ||
23 | artist=$( cmus-remote -Q | grep tag\ artist\ | sed 's/tag artist //' ) | ||
24 | title=$( cmus-remote -Q | grep tag\ title\ | sed 's/tag title //' ) | ||
25 | |||
26 | np_string="$title - $artist" | ||
27 | np_string=$( trunc 35 "$np_string" ) | ||
28 | |||
29 | spc=$(( $(( 32 - ${#np_string} ))/2 )) | ||
30 | spc="$( printf "%${spc}s" )" | ||
31 | |||
32 | if [[ "$status" = *playing* ]] | ||
33 | then | ||
34 | echo -ne "%{F#FF0000}%{F#FFFFFF}PAUSE" | ||
35 | elif [[ "$status" = *paused* ]] | ||
36 | then | ||
37 | echo -ne "PLAY" | ||
38 | elif [[ "$status" = *stopped* ]] | ||
39 | then | ||
40 | echo -ne "START" | ||
41 | fi | ||
42 | |||
43 | else | ||
44 | echo | ||
45 | fi | ||