Skip to content

Commit 2dcf086

Browse files
authored
terminal-helper: Add support for gnome-console (#49)
Signed-off-by: Vasiliy Stelmachenok <ventureo@cachyos.org>
1 parent 9a6587a commit 2dcf086

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/terminal-helper

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ declare -A terminals=(
4848
["kitty"]="kitty $cmd"
4949
["ptyxis"]="ptyxis -- $cmd"
5050
["konsole"]="konsole -e $cmd"
51+
["kgx"]="kgx --wait -- $cmd"
5152
["gnome-terminal"]="gnome-terminal --wait -- $cmd"
5253
["xfce4-terminal"]="xfce4-terminal --disable-server --command '$cmd'"
5354
["lxterminal"]="lxterminal -e $cmd"
@@ -56,11 +57,14 @@ declare -A terminals=(
5657
["foot"]="foot $cmd"
5758
["rio"]="rio -e $cmd"
5859
)
59-
declare -a term_order=("alacritty" "kitty" "ptyxis" "konsole" "gnome-terminal" "xfce4-terminal" "lxterminal" "xterm" "st" "foot" "rio")
60+
declare -a term_order=("alacritty" "kitty" "ptyxis" "konsole" "kgx" "gnome-terminal" "xfce4-terminal" "lxterminal" "xterm" "st" "foot" "rio")
6061

6162
if [ -z "$terminal" ] || ! command -v "$terminal" &> /dev/null; then
6263
for entry in ${term_order[@]}; do
6364
if command -v "$entry" > /dev/null 2>&1; then
65+
# gnome-console does not exit on command completion so we need to kill
66+
# it manually
67+
[[ "$entry" == "kgx" ]] && echo "kill -SIGQUIT \$PPID 2>/dev/null" >> "$file"
6468
terminal="$entry"
6569
break;
6670
fi
@@ -72,5 +76,5 @@ if [ -z "$terminal" ]; then
7276
exit 1
7377
fi
7478

75-
eval "${terminals[${terminal}]}" || { rm "$file"; exit 2; }
79+
eval "${terminals[${terminal}]}" 2>/dev/null || [[ "$terminal" != "kgx" ]] && { rm "$file"; exit 2; }
7680
rm "$file"

0 commit comments

Comments
 (0)