-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathompl-status
executable file
·47 lines (34 loc) · 1.04 KB
/
ompl-status
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
43
44
45
46
#! /usr/bin/env bash
source bszi3b-shared.bash &> /dev/null || source ${0%/*}/bszi3b-shared.bash || exit 1
TAGSTRING=${TAGSTRING:-""}
TAGSTRING_SHORT=${TAGSTRING_SHORT:-"title"}
VOL_SIGNAL=${VOL_SIGNAL:-""}
ICON_PAUSE=${ICON_PAUSE:-""}
ICON_PLAY=${ICON_PLAY:-""}
ICON_STOP=${ICON_STOP:-""}
case "$BLOCK_BUTTON" in
1) ompl play-pause ;;
3) ompl stop ;;
4) ompl previous ;;
5) ompl next ;;
esac
[ -z "$TAGSTRING" ] && tagstring=$(ompl print statusline) || tagstring=$(ompl print tagstring "$TAGSTRING")
[ -z "$tagstring" ] && i3berr "OMPL Off"
[ -z "$TAGSTRING_SHORT" ] && tagstring_short=$tagstring || tagstring_short=$(ompl print tagstring "$TAGSTRING_SHORT")
state=$(ompl print status)
if [ "$state" = "playing" ]; then
icon=$ICON_PLAY
COLOR=$COLOR_HI
elif [ "$state" = "paused" ]; then
icon=$ICON_PAUSE
COLOR=$COLOR_LO
elif [ "$state" = "stopped" ]; then
icon=$ICON_STOP
else
icon="[?]"
COLOR=$COLOR_ERR
fi
LONG=$icon$tagstring
SHORT=$icon$tagstring_short
i3bprint
[ -n $VOL_SIGNAL ] && pkill -RTMIN+$VOL_SIGNAL i3blocks