mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
Add the option for some users (like me) who either don't use swap or don't have much of it, and so aren't allowed to hibernate by the kernel. Instead of telling the kernel to suspend then hibernate, just suspend.
27 lines
747 B
Bash
Executable File
27 lines
747 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# A dmenu wrapper script for system functions.
|
|
|
|
# For systemd-based systems.
|
|
case "$(readlink -f /sbin/init)" in
|
|
*systemd*)
|
|
slp="systemctl suspend -i"
|
|
hib="systemctl suspend-then-hibernate -i"
|
|
shut="systemctl poweroff -i"
|
|
reb="systemctl reboot -i";;
|
|
esac
|
|
|
|
cmds="\
|
|
🔒 lock slock
|
|
🚪 leave dwm kill -TERM $(pgrep -u $USER "\bdwm$")
|
|
♻ renew dwm kill -HUP $(pgrep -u $USER "\bdwm$")
|
|
💤 sleep slock ${slp:-loginctl suspend -i}
|
|
🐻 hibernate slock ${hib:-loginctl suspend-then-hibernate -i}
|
|
🔃 reboot ${reb:-loginctl reboot -i}
|
|
🖥 shutdow ${shut:-systemctl poweroff -i}
|
|
📺 display off xset dpms force off"
|
|
|
|
choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1
|
|
|
|
`echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-`
|