From e8427289d29f50e9b3189e2d0f9f865d0c4ba431 Mon Sep 17 00:00:00 2001 From: Vulcan <93451215+trholding@users.noreply.github.com> Date: Tue, 4 Feb 2025 01:41:48 +0530 Subject: [PATCH] Add alternate terminal support for Linux **Alternate Terminal Support for Linux** The `run` script with `cos_117.cfg` spawns xterms for consoles, but users may prefer other terminals such as konsole, gnome-terminal or even cool-retro-term. To resolve, this commit adds alternate terminal support via: + gen_term_run_cfg - Generates run script and config combo for any alternate terminal. Benefits: - Consoles will launch in the user's desired terminal when the generated script is executed. Usage: ``` gen_term_run_cfg ``` Full Usage: ``` Generate run script and configuration for cray_sim to launch consoles in alternate terminals instead of xterm. Usage: ./gen_term_run_cfg Example - ./gen_term_run_cfg cool-retro-term ``` Tests: - The script was checked in shellcheck with no issues detected. - Tested on Ubuntu 22.04.3 LTS (aarch64) - Tested on Arch Linux (x86_64) --- gen_term_run_cfg | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 gen_term_run_cfg diff --git a/gen_term_run_cfg b/gen_term_run_cfg new file mode 100755 index 0000000..6ec16b1 --- /dev/null +++ b/gen_term_run_cfg @@ -0,0 +1,42 @@ +#!/bin/bash + +usage() { +cat << EOF + +Generate run script and configuration for cray_sim +to launch consoles in alternate terminals instead of +xterm. + +Usage: $0 + + Example - $0 cool-retro-term + +EOF +} + +# Sanity checks +if [ "$#" -ne 1 ]; then usage; exit 1; fi +if [[ ! -f run ]]; then echo "Error: No run file."; exit 1; fi +if [[ ! -f cos_117.cfg ]]; then echo "Error: No cos_117.cfg file."; exit 1; fi + +terminal_name="$1" + +# Uniform naming: - to _ +term_suffix="${terminal_name//-/_}" +cp run "run_${term_suffix}" +cp cos_117.cfg "cos_117_${term_suffix}.cfg" + +# Replace cos_117.cfg and xterm in targets +sed -i "s/xterm/${terminal_name}/g" "cos_117_${term_suffix}.cfg" +sed -i "s/cos_117.cfg/cos_117_${term_suffix}.cfg/" "run_${term_suffix}" +chmod +x "run_${term_suffix}" + +cat << EOF + +Target Terminal : ${terminal_name} +Generated run script : run_${term_suffix} +Generated configuration : cos_117_${term_suffix}.cfg + +Genaration Successful!" + +EOF \ No newline at end of file