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 <terminal-name> ``` Full Usage: ``` Generate run script and configuration for cray_sim to launch consoles in alternate terminals instead of xterm. Usage: ./gen_term_run_cfg <terminal-name> 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)
This commit is contained in:
42
gen_term_run_cfg
Executable file
42
gen_term_run_cfg
Executable file
@@ -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 <terminal-name>
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user