blob: 88c98f02827c0732910dbfe15537cce5f39c5a23 (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#!/bin/sh
start ()
{
wlsunset -l "59.8" -L "30.2" -t "3000" -T "6500" &
}
stop ()
{
pkill -x wlsunset
}
rotate ()
{
pkill -x -SIGUSR1 wlsunset
}
update_waybar ()
{
pkill -x -SIGRTMIN+10 waybar
}
is_active ()
{
pkill -x -0 wlsunset
}
has_wlsunset ()
{
command -v wlsunset >/dev/null
}
case "$1" in
'start')
start
update_waybar
;;
'stop')
stop
update_waybar
;;
'toggle')
is_active && stop || start
update_waybar
;;
'rotate')
rotate
update_waybar
;;
'check')
has_wlsunset
exit $?
;;
esac
if is_active; then
alt="on"
tooltip="Stop/rotate wlsunset"
else
alt="off"
tooltip="Start wlsunset"
fi
printf '{"alt":"%s","tooltip":"%s"}\n' "$alt" "$tooltip"
|