From 15d09bac36f1a5845c87d6c5f4edb64634407546 Mon Sep 17 00:00:00 2001 From: Hekuran Date: Thu, 23 Sep 2021 20:54:58 +0200 Subject: sysact rewrite and minor stuff (#1000) * minor forgoten stuff we already have shutdown in sudo loop * why was this still here? it belongs in ~/.config/ * what the actual phucc * implemented loginctl and fixed shebang --- .config/pinentry/preexec | 5 +++++ .config/shell/aliasrc | 2 +- .local/bin/sysact | 30 +++++++++++++----------------- pinentry/preexec | 5 ----- 4 files changed, 19 insertions(+), 23 deletions(-) create mode 100755 .config/pinentry/preexec delete mode 100755 pinentry/preexec diff --git a/.config/pinentry/preexec b/.config/pinentry/preexec new file mode 100755 index 0000000..93603c7 --- /dev/null +++ b/.config/pinentry/preexec @@ -0,0 +1,5 @@ +#!/hint/sh + +# Define additional functionality for pinentry. For example +test -e /usr/lib/libgcr-base-3.so.1 && exec /usr/bin/pinentry-gnome3 "$@" +#test -e /usr/lib/libQt5Widgets.so.5 && exec /usr/bin/pinentry-qt "$@" diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 0890ccd..ad71695 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -35,7 +35,7 @@ alias \ g="git" \ trem="transmission-remote" \ YT="youtube-viewer" \ - sdn="sudo shutdown -h now" \ + sdn="shutdown -h now" \ e="$EDITOR" \ v="$EDITOR" \ p="pacman" \ 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 diff --git a/pinentry/preexec b/pinentry/preexec deleted file mode 100755 index 93603c7..0000000 --- a/pinentry/preexec +++ /dev/null @@ -1,5 +0,0 @@ -#!/hint/sh - -# Define additional functionality for pinentry. For example -test -e /usr/lib/libgcr-base-3.so.1 && exec /usr/bin/pinentry-gnome3 "$@" -#test -e /usr/lib/libQt5Widgets.so.5 && exec /usr/bin/pinentry-qt "$@" -- cgit v1.3.1