mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
Use non-admin tools to manage system power
Removes the requirement for the user running the script to enter the administrator/sudo password to manage power (which causes lots of strange issues with dmenu and focus etc.).
This commit is contained in:
parent
f05cb5e1bb
commit
34e7d0dc78
@ -2,19 +2,21 @@
|
|||||||
|
|
||||||
# A dmenu wrapper script for system functions.
|
# A dmenu wrapper script for system functions.
|
||||||
|
|
||||||
# For non-systemd init systems.
|
# For systemd-based systems.
|
||||||
case "$(readlink -f /sbin/init)" in
|
case "$(readlink -f /sbin/init)" in
|
||||||
*runit*) hib="sudo -A zzz" ;;
|
*systemd*)
|
||||||
*openrc*) reb="sudo -A openrc-shutdown -r"; shut="sudo -A openrc-shutdown -p 0" ;;
|
hib="systemctl suspend-then-hibernate -i"
|
||||||
|
shut="systemctl poweroff -i"
|
||||||
|
reb="systemctl reboot -i";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
cmds="\
|
cmds="\
|
||||||
🔒 lock slock
|
🔒 lock slock
|
||||||
🚪 leave dwm kill -TERM $(pgrep -u $USER "\bdwm$")
|
🚪 leave dwm kill -TERM $(pgrep -u $USER "\bdwm$")
|
||||||
♻ renew dwm kill -HUP $(pgrep -u $USER "\bdwm$")
|
♻ renew dwm kill -HUP $(pgrep -u $USER "\bdwm$")
|
||||||
🐻 hibernate slock ${hib:-systemctl suspend-then-hibernate -i}
|
🐻 hibernate slock ${hib:-loginctl suspend-then-hibernate -i}
|
||||||
🔃 reboot ${reb:-sudo -A reboot}
|
🔃 reboot ${reb:-loginctl reboot -i}
|
||||||
🖥 shutdown ${shut:-sudo -A shutdown -h now}
|
🖥 shutdow ${shut:-systemctl poweroff -i}
|
||||||
📺 display off xset dpms force off"
|
📺 display off xset dpms force off"
|
||||||
|
|
||||||
choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1
|
choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user