From a2f5a33f548aa6e9077c17dd00a692eb12d736bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 16 Apr 2017 17:42:27 +0200 Subject: Update system pm control in i3 --- config/i3/config | 10 ++++------ config/i3/scripts/shutdown | 13 +++++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100755 config/i3/scripts/shutdown diff --git a/config/i3/config b/config/i3/config index db74e37..46451e4 100644 --- a/config/i3/config +++ b/config/i3/config @@ -135,15 +135,13 @@ bindsym $mod+Shift+c reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) bindsym $mod+Shift+r restart -set $Locker i3lock -c 000000 && sleep 1 && xset dpms force off - set $mode_system System (l) lock, (e) logout, (s) suspend, (r) reboot, (Shift+s) shutdown mode "$mode_system" { - bindsym l exec --no-startup-id $Locker, mode "default" + bindsym l exec --no-startup-id i3lock -c 000000 && sleep 1 && xset dpms force off, mode "default" bindsym e exec --no-startup-id i3-msg exit, mode "default" - bindsym s exec --no-startup-id sys-suspend, mode "default" - bindsym r exec --no-startup-id sys-reboot, mode "default" - bindsym Shift+s exec --no-startup-id sys-shutdown, mode "default" + bindsym s exec --no-startup-id sudo pm-suspend, mode "default" + bindsym r exec --no-startup-id sudo reboot, mode "default" + bindsym Shift+s exec --no-startup-id ~/.config/i3/scripts/shutdown, mode "default" # back to normal: Enter or Escape bindsym Return mode "default" diff --git a/config/i3/scripts/shutdown b/config/i3/scripts/shutdown new file mode 100755 index 0000000..62f6ae1 --- /dev/null +++ b/config/i3/scripts/shutdown @@ -0,0 +1,13 @@ +#!/bin/sh + +export SUDO_ASKPASS=/tmp/shutdown-askpass.sh + + +echo '#!/bin/sh +echo "SETDESC Please enter password to shutdown system +SETPROMPT Password: +SETTITLE Sudo password for system shutdown +GETPIN" | pinentry | grep -E "^D " | sed "s/^D //"' > $SUDO_ASKPASS +chmod +x $SUDO_ASKPASS + +sudo -A shutdown -h now -- cgit v1.2.3