wl-mitm/contrib/ask-bemenu.sh
Peter Cai 23de31af7b Implement application toplevel title and id tracking
This makes messages emitted by ask and notify commands much better
2025-03-05 21:50:24 -05:00

21 lines
425 B
Bash
Executable file

#!/usr/bin/env bash
prompt="$3"
if [ -z "$prompt" ]; then
prompt="calling $1::$2?"
fi
if [ ! -z "$WL_MITM_LAST_TOPLEVEL_TITLE" ]; then
prompt="\"$WL_MITM_LAST_TOPLEVEL_TITLE\" $prompt"
elif [ ! -z "$WL_MITM_LAST_TOPLEVEL_APP_ID" ]; then
prompt="\"$WL_MITM_LAST_TOPLEVEL_APP_ID\" $prompt"
fi
res=$(echo -e "yes\nno" | bemenu -l 2 -s --prompt "Allow $prompt?")
if [ "$res" == "yes" ]; then
exit 0
else
exit 1
fi