#!/bin/sh case "$(readlink -f /sbin/init)" in *systemd*) ctl='systemctl' ;; *) ctl='loginctl' ;; esac action="$(printf "Screen off\nLock\nSleep\nReboot\nShutdown" | dmenu -i -c -l 5 -p 'Action:')" case "$action" in "Screen off") xset dpms force off ;; "Lock") xset dpms force off && slock ;; "Sleep") slock $ctl suspend -i ;; "Reboot") $ctl reboot -i ;; "Shutdown") $ctl poweroff -i ;; *) exit ;; esac