diff options
| author | Luke Smith <luke@lukesmith.xyz> | 2021-10-02 11:53:40 -0400 |
|---|---|---|
| committer | Luke Smith <luke@lukesmith.xyz> | 2021-10-02 11:53:40 -0400 |
| commit | 163738e6ad1954c8a8a16dae98829c51cf9da4be (patch) | |
| tree | 8742b1c2f7751abf47886aeea6622eabe81c464a /.local/bin/sysact | |
| parent | a3a630a3e839a730d26a137f35cce2065bbbb16f (diff) | |
| parent | 162ed8889b9893b790ca529e564d976f8190e3f3 (diff) | |
| download | eibhear-163738e6ad1954c8a8a16dae98829c51cf9da4be.tar.gz eibhear-163738e6ad1954c8a8a16dae98829c51cf9da4be.tar.zst eibhear-163738e6ad1954c8a8a16dae98829c51cf9da4be.zip | |
Merge branch 'master' of github.com:LukeSmithxyz/voidrice
Diffstat (limited to '.local/bin/sysact')
| -rwxr-xr-x | .local/bin/sysact | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/.local/bin/sysact b/.local/bin/sysact index a820158..451815d 100755 --- a/.local/bin/sysact +++ b/.local/bin/sysact @@ -1,22 +1,18 @@ #!/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" ;; + *systemd*) ctl='systemctl' ;; + *) ctl='loginctl' ;; 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} -📺 display off xset dpms force off" - -choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1 - -eval "$(echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-)" +case "$(printf "🔒 lock\n🚪 leave dwm\n♻️ renew dwm\n🐻 hibernate\n💤 sleep\n🔃 reboot\n🖥️shutdown\n📺 display off" | dmenu -i -p 'Action: ')" in + '🔒 lock') slock ;; + '🚪 leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;; + '♻️ renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;; + '🐻 hibernate') slock $ctl hibernate ;; + '💤 sleep') slock $ctl suspend ;; + '🔃 reboot') $ctl reboot ;; + '🖥️shutdown') $ctl poweroff ;; + '📺 display off') xset dpms force off ;; + *) exit 1 ;; +esac |
