-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbusy
More file actions
executable file
·48 lines (39 loc) · 860 Bytes
/
busy
File metadata and controls
executable file
·48 lines (39 loc) · 860 Bytes
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
47
48
#!/bin/bash -e
# Turn on a busy light.
usage() {
echo "usage: ${0##*/} [color] [options]" 1>&2
echo "" 1>&2
echo "Turn on a busy light." 1>&2
echo ""
echo "options:"
echo " -h or --help shows usage help" 1>&2
exit 1
}
if echo "$*" | grep -Eq -- '--help\b|-h\b'; then
usage
fi
# shellcheck source=.hue_control
# shellcheck disable=SC1091
source "$HOME/.hue_control" || echo "$(tput bold)error: ~/.hue_control not installed!$(tput sgr0)" >&2
release() {
hue_set_color green
}
trap release EXIT
COLOR="${1:-red}"
COLORS=("$@")
CLEN="${#COLORS[@]}"
if [[ $CLEN -gt 1 ]]; then
C=0
while true; do
COLOR="${COLORS[$C]}"
hue_set_busy "$COLOR"
C=$(((C + 1) % CLEN))
sleep .5
done
fi
while true; do
if ! hue_is_busy; then
hue_set_busy "$COLOR"
fi
sleep 10
done