#!/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