mirror of https://gitlab.com/dabruh/dotfiles.git
17 lines
516 B
Bash
Executable File
17 lines
516 B
Bash
Executable File
#!/bin/bash
|
|
|
|
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."
|
|
|
|
CONFIRMATION="$(xargs -n 1 <<<"No Yes" | dmenu -i -p "Are you sure you want to ${ACTION,,}?")"
|
|
{ [ -z "$CONFIRMATION" ] || [[ "$CONFIRMATION" != "Yes" ]]; } && exit 1
|
|
|
|
echo "INFO: Action confirmed."
|
|
|
|
if ! i3exit "${ACTION,,}"; then
|
|
echo "ERROR: Invalid action '${ACTION,,}'." 1>&2
|
|
exit 2
|
|
fi
|