From da1970edd5db2f2c1cf879ad1c58a824b40322ff Mon Sep 17 00:00:00 2001 From: "easyaspi314 (Devin)" Date: Wed, 29 Sep 2021 12:02:30 -0400 Subject: [PATCH 1/2] Add detection for Termux terminal Termux sets the TERMUX_VERSION environment variable. --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index db47a471..c29d41ed 100755 --- a/neofetch +++ b/neofetch @@ -3292,6 +3292,7 @@ get_term() { [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]] && term="TosWin2" [[ "$SSH_CONNECTION" ]] && term="$SSH_TTY" [[ "$WT_SESSION" ]] && term="Windows Terminal" + [[ "$TERMUX_VERSION" ]] && term="Termux ${TERMUX_VERSION}" # Check $PPID for terminal emulator. while [[ -z "$term" ]]; do From c4630ee21528ec8d27fd6cbecd568d087255cac5 Mon Sep 17 00:00:00 2001 From: "easyaspi314 (Devin)" Date: Wed, 29 Sep 2021 12:12:56 -0400 Subject: [PATCH 2/2] Only fall back to TERMUX_VERSION if ppid doesn't match Catches something like running xfce4-terminal in an X server --- neofetch | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index c29d41ed..f0a20204 100755 --- a/neofetch +++ b/neofetch @@ -3292,7 +3292,6 @@ get_term() { [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]] && term="TosWin2" [[ "$SSH_CONNECTION" ]] && term="$SSH_TTY" [[ "$WT_SESSION" ]] && term="Windows Terminal" - [[ "$TERMUX_VERSION" ]] && term="Termux ${TERMUX_VERSION}" # Check $PPID for terminal emulator. while [[ -z "$term" ]]; do @@ -3332,6 +3331,10 @@ get_term() { esac done + # Termux sets TERMUX_VERSION. Put this after the PPID check because this is + # also set if using a terminal on an X server. + [[ -z "$term" && "$TERMUX_VERSION" ]] && term="Termux ${TERMUX_VERSION}" + # Log that the function was run. term_run=1 }