mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
- Format all shell scripts using [shfmt] (https://github.com/mvdan/sh). Options used: * `-bn`: binary ops like && and | may start a line * `-sr`: redirect operators will be followed by a space * `-ci`: indent switch cases * `-i 4`: indent 4 spaces * `-s`: simplify the code * `-p`: parse for posix compliance - Add Github action to lint changes to scripts and enforce formatting going forward Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
25 lines
667 B
Bash
Executable File
25 lines
667 B
Bash
Executable File
#!/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="\
|
|
🔒 lock slock
|
|
🚪 leave dwm kill -TERM $(pgrep -u $USER "\bdwm$")
|
|
♻ renew dwm kill -HUP $(pgrep -u $USER "\bdwm$")
|
|
🐻 hibernate slock ${hib:-systemctl suspend-then-hibernate -i}
|
|
🔃 reboot ${reb:-sudo -A reboot}
|
|
🖥 shutdown ${shut:-sudo -A shutdown -h now}"
|
|
|
|
choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1
|
|
|
|
$(echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-)
|