#!/bin/sh # A dmenu wrapper script for system functions. # For non-systemd init systems. case "$(readlink -f /sbin/init)" in *runit*) hib="sudo -A zzz" ;; *openrc*) reb="sudo -A openrc-shutdown -r"; shut="sudo -A openrc-shutdown -p" ;; esac cmds="\ $(ico lock) lock slock $(ico leave) leave dwm kill -TERM $(pidof -s dwm) $(ico renew) renew dwm kill -HUP $(pidof -s dwm) $(ico hib) hibernate ${hib:-sudo -A systemctl suspend-then-hibernate} $(ico reboot) reboot ${reb:-sudo -A reboot} $(ico shutdown) shutdown ${shut:-sudo -A shutdown -h now}" choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1 `echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-`