mirror of https://gitlab.com/dabruh/dotfiles.git
Feed dmenuexit the commands from i3exit.
This commit is contained in:
parent
aa1f40e58d
commit
51c3918628
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
ACTION="$(xargs -n 1 <<<"Lock Suspend Hibernate Logout Shutdown Reboot" | dmenu -i -p "exitctl")"
|
||||
COMMANDS="$(i3exit commands | sed 's/\,/\ /g' | sed 's/.*/\L&/; s/[a-z]*/\u&/g')"
|
||||
ACTION="$(xargs -n 1 <<<"$COMMANDS" | dmenu -i -p "exitctl")"
|
||||
[ -z "$ACTION" ] && exit 1
|
||||
echo "INFO: Selected action $ACTION."
|
||||
|
||||
|
@ -9,26 +10,7 @@ CONFIRMATION="$(xargs -n 1 <<<"No Yes" | dmenu -i -p "Are you sure you want to $
|
|||
|
||||
echo "INFO: Action confirmed."
|
||||
|
||||
case "${ACTION,,}" in
|
||||
lock)
|
||||
loginctl lock-session
|
||||
;;
|
||||
suspend)
|
||||
systemctl suspend
|
||||
;;
|
||||
hibernate)
|
||||
systemctl hibernate
|
||||
;;
|
||||
logout)
|
||||
i3-msg exit
|
||||
;;
|
||||
shutdown)
|
||||
poweroff
|
||||
;;
|
||||
reboot)
|
||||
reboot
|
||||
;;
|
||||
*)
|
||||
if ! i3exit "${ACTION,,}"; then
|
||||
echo "ERROR: Invalid action '${ACTION,,}'." 1>&2
|
||||
;;
|
||||
esac
|
||||
exit 2
|
||||
fi
|
||||
|
|
|
@ -37,9 +37,16 @@ case "$1" in
|
|||
shutdown)
|
||||
$logind poweroff
|
||||
;;
|
||||
commands)
|
||||
echo "lock,logout,switch_user,suspend,hibernate,reboot,shutdown"
|
||||
;;
|
||||
help)
|
||||
cmds="$($0 commands)"
|
||||
echo "Usage: $0 ${cmds//\,/\, }"
|
||||
;;
|
||||
*)
|
||||
echo "== ! i3exit: missing or invalid argument ! =="
|
||||
echo "Try again with: lock | logout | switch_user | suspend | hibernate | reboot | shutdown"
|
||||
$0 help
|
||||
exit 2
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in New Issue