diff options
| author | ryukamish <[email protected]> | 2026-06-06 01:21:38 +0530 |
|---|---|---|
| committer | ryukamish <[email protected]> | 2026-06-06 01:21:38 +0530 |
| commit | 89afa6de2800207d2b3f33bc896b6bf3eaf3b706 (patch) | |
| tree | 04f3b27c5a61f6ff4082f9451a19c4503f3d75a9 /usr/local/bin/sway-power | |
| parent | 16fc24e1786d47386db69737395e23411224ae96 (diff) | |
add: user scripts
Diffstat (limited to 'usr/local/bin/sway-power')
| -rwxr-xr-x | usr/local/bin/sway-power | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/usr/local/bin/sway-power b/usr/local/bin/sway-power new file mode 100755 index 0000000..82088ad --- /dev/null +++ b/usr/local/bin/sway-power @@ -0,0 +1,25 @@ +#!/bin/sh + +_have() { + command -v "$1" +} + +PWR_OPTS=$(printf '%b' 'Lock\nReboot\nShutdown\nSuspend\nHibernate' | bemenu -l 5 -i -p 'Power menu:') + +case "$PWR_OPTS" in + Hibernate) + systemctl hibernate + ;; + Lock) + _have swaylock && swaylock --daemonize && swaymsg 'output * power off' + ;; + Reboot) + systemctl reboot + ;; + Shutdown) + systemctl poweroff + ;; + Suspend) + systemctl suspend + ;; +esac |
