summaryrefslogtreecommitdiff
path: root/.local/bin/sway-power
diff options
context:
space:
mode:
authorryukamish <[email protected]>2026-06-06 01:44:49 +0530
committerryukamish <[email protected]>2026-06-06 01:44:49 +0530
commit51183654e84b12d38cf72d8581f950269d6b47c1 (patch)
treebb327aff9bc87c692d401f392ce375c52133e965 /.local/bin/sway-power
parentb91a830fe91c2819cb0ca9b91dcfdcb02b2a2ead (diff)
fix: directory and symlink path change
Diffstat (limited to '.local/bin/sway-power')
-rwxr-xr-x.local/bin/sway-power25
1 files changed, 25 insertions, 0 deletions
diff --git a/.local/bin/sway-power b/.local/bin/sway-power
new file mode 100755
index 0000000..82088ad
--- /dev/null
+++ b/.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