workspace/arch-user/bin/bemenu/run-calc.sh
2025-07-05 23:11:30 +00:00

20 lines
508 B
Bash
Executable File

#!/bin/bash
shift
query="$1"
if [ -z "$query" ]; then
query="$(echo "tui" | bemenu --prompt "qalc")"
fi
if [ "$query" = "tui" ]; then
exec footclient --app-id="footclient_float" -D ~/ "qalc";
elif [ -n "$query" ]; then
qalc_res="$(qalc --terse "$query")"
menu_res="$(echo -e "$qalc_res\ntui" | bemenu --prompt "qalc")"
if [ "$qalc_res" = "$menu_res" ]; then
wl-copy "$qalc_res"
notify-send "$qalc_res" -a calc "Result copied to clipboard"
elif [ -n "$menu_res" ]; then
"$0" _ "$menu_res"
fi
fi