summaryrefslogtreecommitdiff
path: root/private_dot_local/bin/executable_waybar-sunset
diff options
context:
space:
mode:
authorLibravatar Martin Michalec <martin@michalec.dev>2026-02-11 02:47:33 +0000
committerLibravatar Martin Michalec <martin@michalec.dev>2026-02-11 02:47:33 +0000
commit2c485ce2b43bd810a88278215b771136a2a17881 (patch)
tree3fb74338b87553d898af7b1795de7322cbc5af63 /private_dot_local/bin/executable_waybar-sunset
parentadd xdg (diff)
downloaddotfiles-2c485ce2b43bd810a88278215b771136a2a17881.tar.gz
add scripts
Diffstat (limited to 'private_dot_local/bin/executable_waybar-sunset')
-rw-r--r--private_dot_local/bin/executable_waybar-sunset64
1 files changed, 64 insertions, 0 deletions
diff --git a/private_dot_local/bin/executable_waybar-sunset b/private_dot_local/bin/executable_waybar-sunset
new file mode 100644
index 0000000..88c98f0
--- /dev/null
+++ b/private_dot_local/bin/executable_waybar-sunset
@@ -0,0 +1,64 @@
1#!/bin/sh
2
3start ()
4{
5 wlsunset -l "59.8" -L "30.2" -t "3000" -T "6500" &
6}
7
8stop ()
9{
10 pkill -x wlsunset
11}
12
13rotate ()
14{
15 pkill -x -SIGUSR1 wlsunset
16}
17
18update_waybar ()
19{
20 pkill -x -SIGRTMIN+10 waybar
21}
22
23is_active ()
24{
25 pkill -x -0 wlsunset
26}
27
28has_wlsunset ()
29{
30 command -v wlsunset >/dev/null
31}
32
33case "$1" in
34 'start')
35 start
36 update_waybar
37 ;;
38 'stop')
39 stop
40 update_waybar
41 ;;
42 'toggle')
43 is_active && stop || start
44 update_waybar
45 ;;
46 'rotate')
47 rotate
48 update_waybar
49 ;;
50 'check')
51 has_wlsunset
52 exit $?
53 ;;
54esac
55
56if is_active; then
57 alt="on"
58 tooltip="Stop/rotate wlsunset"
59else
60 alt="off"
61 tooltip="Start wlsunset"
62fi
63
64printf '{"alt":"%s","tooltip":"%s"}\n' "$alt" "$tooltip"