diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2021-05-01 11:04:19 -0400 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2021-05-01 11:04:19 -0400 |
commit | 9ed9de5006d437e126c5871dc0cf38a02825aabb (patch) | |
tree | d92d4b6ad254626312ed84c78063dffb73dfa639 /.local/bin/sysact | |
parent | af79f164cc50ae0299b3820e9cab290cb6fbcd82 (diff) |
workstation Files
Diffstat (limited to '.local/bin/sysact')
-rwxr-xr-x | .local/bin/sysact | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/.local/bin/sysact b/.local/bin/sysact new file mode 100755 index 0000000..5249070 --- /dev/null +++ b/.local/bin/sysact @@ -0,0 +1,22 @@ +#!/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 0" ;; +esac + +cmds="\ + lock sudo loginctl lock-sessions + leave dwm killall xinit + renew dwm killall dwm + hibernate sudo loginctl hibernate + reboot ${reb:-sudo -A reboot} + shutdown ${shut:-sudo -A shutdown -h now} + display off xset dpms force off" + +choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1 + +`echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-` |