From 0f0a45b7fcd3a074c5918947270ed4112001c37d Mon Sep 17 00:00:00 2001 From: jphager2 Date: Sat, 13 Oct 2018 01:30:07 +0200 Subject: [PATCH] Allow TERMINAL to be set by environment --- apply-colors.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/apply-colors.sh b/apply-colors.sh index 1b40164..43606e6 100755 --- a/apply-colors.sh +++ b/apply-colors.sh @@ -102,16 +102,18 @@ set_theme() { # | # | Check for the terminal name (depening on os) # | =========================================== -OS=$(uname) -if [ "$OS" = "Darwin" ]; then - # | - # | Check for the terminal name and decide how to apply - # | =========================================== - TERMINAL=$TERM_PROGRAM -elif [ "${OS#CYGWIN}" != "${OS}" ]; then - TERMINAL="mintty" -else - TERMINAL="$(ps -p $(ps -p $(ps -p $$ -o ppid=) -o ppid=) -o args=)" +if [[ -z "$TERMINAL" ]]; then + OS=$(uname) + if [ "$OS" = "Darwin" ]; then + # | + # | Check for the terminal name and decide how to apply + # | =========================================== + TERMINAL=$TERM_PROGRAM + elif [ "${OS#CYGWIN}" != "${OS}" ]; then + TERMINAL="mintty" + else + TERMINAL="$(ps -p $(ps -p $(ps -p $$ -o ppid=) -o ppid=) -o args=)" + fi fi # |