commit 471ea3ec2ced1c0713a1676d48a13297d1688f2c parent c1b3c05be8d9aa90015eb9327e029d4f965e5434 Author: Oscar Benedito <oscar@oscarbenedito.com> Date: Mon, 22 Jun 2020 01:47:25 +0200 Add logout script Diffstat:
M | .config/zsh/.zshenv | | | 1 | + |
A | .local/bin/session-dmenu | | | 12 | ++++++++++++ |
A | .local/bin/sudoaskpass-dmenu | | | 3 | +++ |
3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv @@ -23,6 +23,7 @@ export LESSHISTFILE="-" export VISUAL="nvim" export EDITOR="nvim" export TERMINAL="alacritty" +export SUDO_ASKPASS="$HOME/.local/bin/sudoaskpass-dmenu" # Go bin to path [ -d "$XDG_DATA_HOME/go/bin" ] && export PATH="$XDG_DATA_HOME/go/bin:$PATH" diff --git a/.local/bin/session-dmenu b/.local/bin/session-dmenu @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +cmds="\ +lock | slock +exit | kill -TERM $(pidof -s dwm) +hibernate | sudo -A systemctl suspend-then-hibernate +reboot | sudo -A reboot +shutdown | sudo -A shutdown -h now" + +choice="$(echo "$cmds" | sed "s/ *|/|/g" | cut -d'|' -f 1 | dmenu)" || exit 1 + +`echo "$cmds" | grep "^$choice *| " | cut -d '|' -f2-` diff --git a/.local/bin/sudoaskpass-dmenu b/.local/bin/sudoaskpass-dmenu @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +dmenu -P -p "$1" <&- && echo