blob: 8bdcf8c14455c63c3838186f178a08e7c5c515b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/bin/bash
# TODO: notify-send on non availabilty of mpc
mpc "$@" > /dev/null
lines=`mpc | wc -l`
if [ $lines -gt 1 ];
then
line1="`mpc | head -n 1`"
line2="`mpc | head -n 3 | tail -n 2 | sed 's/[a-z]*\:\ off//g'`"
status="`echo $line2 | awk '{ print $1 }'`"
position="`echo $line2 | awk '{ print $3 }'`"
position="($position)"
volume="[`echo $line2 | awk '{ print $5 $6 }' | sed 's/volume\://' | sed 's/repeat\://'`]"
repeat="`echo $line2 | grep -c 'repeat: on' | sed 's/1/r/' | sed 's/0//'`"
random="`echo $line2 | grep -c 'random: on' | sed 's/1/z/' | sed 's/0//'`"
single="`echo $line2 | grep -c 'single: on' | sed 's/1/s/' | sed 's/0//'`"
consume="`echo $line2 | grep -c 'consume: on' | sed 's/1/c/' | sed 's/0//'`"
flags="[$repeat$random$single$consume]"
title="$line1"
text="$status $position $flags $volume"
else
line="`mpc | sed 's/[a-z]*\:\ off//g'`"
volume="[`echo $line | awk '{ print $2 }'`]"
repeat="`echo $line | grep -c 'repeat: on' | sed 's/1/r/' | sed 's/0//'`"
random="`echo $line | grep -c 'random: on' | sed 's/1/z/' | sed 's/0//'`"
single="`echo $line | grep -c 'single: on' | sed 's/1/s/' | sed 's/0//'`"
consume="`echo $line | grep -c 'consume: on' | sed 's/1/c/' | sed 's/0//'`"
flags="[$repeat$random$single$consume]"
title="not playing"
text="$flags $volume"
fi
## NOTIFY-SEND
notify-send -t 2000 "$title" "$text"
|