fix: unify screenshot tool existence logic

Fixes: https://github.com/ben-grande/qusal/issues/51
This commit is contained in:
Ben Grande 2024-05-24 23:30:43 +02:00
parent 444672e999
commit efcf8c7723
No known key found for this signature in database
GPG Key ID: 00C64E14F51F9E56

View File

@ -141,12 +141,11 @@ else
elif command -v zenity >/dev/null; then
dialog_cmd="zenity"
fi
fi
if test -z "${dialog_cmd}"; then
echo "[ERROR] dialog programs not found: zenity kdialog"
exit 1
fi
fi
if test -n "${screenshot_cmd_wanted}"; then
if ! command -v "${screenshot_cmd_wanted}" >/dev/null; then
@ -156,10 +155,16 @@ if test -n "${screenshot_cmd_wanted}"; then
zenity) zenity --info --text "${msg}";;
kdialog) kdialog --msgbox "${msg}";;
esac
exit 1
fi
case "${screenshot_cmd_wanted}" in
maim|scrot|spectacle|xfce4-screenshooter);;
*)
msg="wanted screenshot program unsupported: ${screenshot_cmd_wanted}"
echo "[ERROR] ${msg}"
exit 1
fi
;;
esac
screenshot_cmd="${screenshot_cmd_wanted}"
else
if command -v maim >/dev/null; then