Diverses modifs

This commit is contained in:
Breizh 2019-09-22 03:31:29 +02:00
parent dd6891a630
commit e9d6ecad70
6 changed files with 32 additions and 33 deletions
.i3blocks

View file

@ -1,8 +1,25 @@
#!/bin/bash
if ! systemctl --user is-active mpd &>/dev/null
then
origstatus='off'
else
origstatus="$(mpc status | sed -n '2p' | grep -Eo '^\[.*\]' | tr -d '[]')"
[[ -z "$origstatus" ]] && origstatus='stop'
fi
LONG=25
SHORT=10
case $BLOCK_BUTTON in
1) mpc -q prev ;;
2) mpc -q toggle ;;
3) mpc -q next ;;
4) mpc -q volume +2 ;;
5) mpc -q volume -2 ;;
#?*) notify-send "Test" "$BLOCK_BUTTON" ;;
esac
human_time() {
local seconds="$1"
if [[ "$seconds" -lt 0 ]]
@ -21,24 +38,7 @@ human_time() {
return
}
if ! systemctl --user is-active mpd &>/dev/null
then
origstatus='off'
else
origstatus="$(mpc status | sed -n '2p' | grep -Eo '^\[.*\]' | tr -d '[]')"
[[ -z "$origstatus" ]] && origstatus='stop'
fi
case $BLOCK_BUTTON in
1) mpc -q prev ;;
2) mpc -q toggle ;;
3) mpc -q next ;;
4) mpc -q volume +2 ;;
5) mpc -q volume -2 ;;
#?*) notify-send "Test" "$BLOCK_BUTTON" ;;
esac
status="<span foreground=\"#6699CC\">"
case $origstatus in
stop ) status="<span foreground=\"#F2777A\">" ;;
@ -112,17 +112,17 @@ then
if [[ "$longsong" =~ § ]]
then
longsong="<u>${longsong/§/</u> }"
longsong="<i>${longsong/§/</i> }"
elif [[ "$song" =~ § ]]
then
longsong="<u>${longsong}</u>"
longsong="<i>${longsong}</i>"
fi
if [[ "$shortsong" =~ § ]]
then
shortsong="<u>${shortsong/§/</u> }"
shortsong="<i>${shortsong/§/</i> }"
elif [[ "$song" =~ § ]]
then
shortsong="<u>${shortsong}</u>"
shortsong="<i>${shortsong}</i>"
fi
echo "${longsong} $status$longtime</span>"