From 4f4c397970795fdbf0596238bf5f259f86b1aefb Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 20 Oct 2026 14:09:05 -0400 Subject: [PATCH] Move terminal detection to the beginning so you don't get most of the way through setup and have to restart if no terminal is installed. --- README.md | 1 + i38.sh | 39 ++++++++++++++++----------------------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 5fe0e03..857c28b 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ Required for the setup script and generated I38 configuration: - python-gobject: For the accessible GTK application menu, run dialog, and desktop dialog. - python-i3ipc: For i3 integration scripts. - rsync: For installing I38 scripts without generated Python cache files. +- A supported terminal emulator: mate-terminal, lxterminal, gnome-terminal, terminator, xfce4-terminal, tilix, ptyxis, kgx, sakura, roxterm, termit, guake, tilda, qterminal, or konsole; alternatively, both xterm and fenrir. Setup checks for one before asking configuration questions. - yad: For screen reader accessible dialogs. - xdg-utils: For opening files and URLs from the run dialog. - xdotool: For X11 window interaction. diff --git a/i38.sh b/i38.sh index a39f3ae..0be6268 100755 --- a/i38.sh +++ b/i38.sh @@ -43,6 +43,18 @@ if command -v python3 &> /dev/null ; then missing+=("python-gobject") fi fi +availableTerminals=() +for i in mate-terminal lxterminal gnome-terminal terminator xfce4-terminal tilix ptyxis kgx sakura roxterm termit guake tilda qterminal konsole ; do + if command -v "$i" &> /dev/null ; then + availableTerminals+=("$i") + fi +done +if command -v xterm &> /dev/null && command -v fenrir &> /dev/null ; then + availableTerminals+=("xterm") +fi +if [[ ${#availableTerminals[@]} -eq 0 ]]; then + missing+=("supported terminal emulator (e.g. mate-terminal or lxterminal, or both xterm and fenrir)") +fi if [[ ${#missing[@]} -gt 0 ]]; then echo "Please install the following packages and run this script again:" echo "${missing[*]}" @@ -230,10 +242,7 @@ set_default_configuration() { textEditor="$(first_available_path emacs geany gedit kate kwrite l3afpad leafpad libreoffice mousepad pluma || true)" fileBrowser="$(first_available_path caja nemo nautilus pcmanfm pcmanfm-qt thunar || true)" ircClient="$(first_available_path albikirc Albikirc access-irc || true)" - terminalEmulator="$(first_available_path mate-terminal lxterminal gnome-terminal terminator xfce4-terminal tilix ptyxis kgx sakura roxterm termit guake tilda qterminal konsole || true)" - if [[ -z "$terminalEmulator" ]] && command -v xterm &> /dev/null && command -v fenrir &> /dev/null; then - terminalEmulator="$(command -v xterm)" - fi + terminalEmulator="$(command -v "${availableTerminals[0]}")" udiskie=1 if command -v udiskie &> /dev/null; then udiskie=0 @@ -994,28 +1003,12 @@ else export ircClient fi # Terminal emulator -if [[ $defaultConfig -eq 1 && -z "$terminalEmulator" ]]; then - echo "No supported terminal emulator was found. Please install mate-terminal, lxterminal, gnome-terminal, terminator, another supported accessible terminal, or install both xterm and fenrir." - exit 1 -fi if [[ $defaultConfig -eq 0 ]] && { [[ -z "$terminalEmulator" ]] || { [[ ! -x "$terminalEmulator" ]] && ! command -v "$terminalEmulator" &> /dev/null; }; }; then configChanged=1 - programList=() - for i in mate-terminal lxterminal gnome-terminal terminator xfce4-terminal tilix ptyxis kgx sakura roxterm termit guake tilda qterminal konsole ; do - if command -v "$i" &> /dev/null ; then - programList+=("$i") - fi - done - if command -v xterm &> /dev/null && command -v fenrir &> /dev/null ; then - programList+=("xterm") - fi - if [[ ${#programList[@]} -eq 0 ]]; then - dialog --title "I38" --msgbox "No supported terminal emulator was found. Please install mate-terminal, lxterminal, gnome-terminal, terminator, another supported accessible terminal, or install both xterm and fenrir." -1 -1 - exit 1 - elif [[ ${#programList[@]} -gt 1 ]]; then - terminalEmulator="$(menulist "Terminal emulator:" "${programList[@]}")" + if [[ ${#availableTerminals[@]} -gt 1 ]]; then + terminalEmulator="$(menulist "Terminal emulator:" "${availableTerminals[@]}")" else - terminalEmulator="${programList[0]}" + terminalEmulator="${availableTerminals[0]}" fi terminalEmulator="$(command -v "$terminalEmulator")" export terminalEmulator