diff options
| author | 2026-02-11 02:47:33 +0000 | |
|---|---|---|
| committer | 2026-02-11 02:47:33 +0000 | |
| commit | 2c485ce2b43bd810a88278215b771136a2a17881 (patch) | |
| tree | 3fb74338b87553d898af7b1795de7322cbc5af63 /private_dot_local/bin/executable_waybar-sunset | |
| parent | add xdg (diff) | |
| download | dotfiles-2c485ce2b43bd810a88278215b771136a2a17881.tar.gz | |
add scripts
Diffstat (limited to 'private_dot_local/bin/executable_waybar-sunset')
| -rw-r--r-- | private_dot_local/bin/executable_waybar-sunset | 64 |
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 | |||
| 3 | start () | ||
| 4 | { | ||
| 5 | wlsunset -l "59.8" -L "30.2" -t "3000" -T "6500" & | ||
| 6 | } | ||
| 7 | |||
| 8 | stop () | ||
| 9 | { | ||
| 10 | pkill -x wlsunset | ||
| 11 | } | ||
| 12 | |||
| 13 | rotate () | ||
| 14 | { | ||
| 15 | pkill -x -SIGUSR1 wlsunset | ||
| 16 | } | ||
| 17 | |||
| 18 | update_waybar () | ||
| 19 | { | ||
| 20 | pkill -x -SIGRTMIN+10 waybar | ||
| 21 | } | ||
| 22 | |||
| 23 | is_active () | ||
| 24 | { | ||
| 25 | pkill -x -0 wlsunset | ||
| 26 | } | ||
| 27 | |||
| 28 | has_wlsunset () | ||
| 29 | { | ||
| 30 | command -v wlsunset >/dev/null | ||
| 31 | } | ||
| 32 | |||
| 33 | case "$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 | ;; | ||
| 54 | esac | ||
| 55 | |||
| 56 | if is_active; then | ||
| 57 | alt="on" | ||
| 58 | tooltip="Stop/rotate wlsunset" | ||
| 59 | else | ||
| 60 | alt="off" | ||
| 61 | tooltip="Start wlsunset" | ||
| 62 | fi | ||
| 63 | |||
| 64 | printf '{"alt":"%s","tooltip":"%s"}\n' "$alt" "$tooltip" | ||
