1
0
mirror of https://github.com/Mayccoll/Gogh.git synced 2023-08-10 21:12:46 +03:00

Major update with tilix support

This commit is contained in:
phenonymous 2018-11-27 11:10:12 +01:00
parent 3e0fffd675
commit 0ef494e0ae
2 changed files with 261 additions and 209 deletions

View File

@ -20,20 +20,20 @@ case "${TERMINAL}" in
mintty )
CFGFILE="${HOME}/.minttyrc"
if [[ ! -f "$CFGFILE" ]]; then
if [[ ! -f "${CFGFILE}" ]]; then
printf '\n%s\n' "Warning: Couldn't find an existing configuration file, so one will be created for you."
printf '%s\n\n' "Warning: Are you really running Cygwin's mintty?"
touch "$CFGFILE"
touch "${CFGFILE}"
fi
;;
guake|tilix|mate-terminal|gnome-terminal* )
case "${TERMINAL}" in
guake|gnome-terminal* )
if [[ -z "${DCONF}" ]] && [[ -z "${GCONFTOOL}" ]]; then
if [[ -z "${DCONF}" ]] && [[ -z "${GCONF}" ]]; then
printf '\n%s\n' "Error gconftool not found!"
printf '%s\n' "sudo apt install gconftool?"
printf '%s\n\n' "or export GCONFTOOL=/path/to/gconftool/"
printf '%s\n\n' "or export GCONF=/path/to/gconftool-2/"
exit 1
fi
;;
@ -70,121 +70,137 @@ hexRGBtoDecRGB () {
G="$(hexToDec "${1:3:2}")"
B="$(hexToDec "${1:5:2}")"
echo "$R" "$G" "$B"
echo "${R}" "${G}" "${B}"
}
convertRGBtoMac () {
set -- $(hexRGBtoDecRGB "$1")
R=$1; shift; G=$1; shift; B=$1; shift
local color="${1}"
set -
set -- $(hexRGBtoDecRGB "${color}")
R=${1}; shift; G=${1}; shift; B=${1}; shift
R=$(echo "${R} / 255" | bc -l)
G=$(echo "${G} / 255" | bc -l)
B=$(echo "${B} / 255" | bc -l)
echo "$R" "$G" "$B"
echo "${R}" "${G}" "${B}"
}
createMinttyEntry () {
local name="$1"
local colour="$2"
set --
set -- $(hexRGBtoDecRGB "$colour")
R=$1; shift; G=$1; shift; B=$1; shift
local name="${1}"
local color="${2}"
set -
set -- $(hexRGBtoDecRGB "${color}")
R=${1}; shift; G=${1}; shift; B=${1}; shift
echo "$name=$R,$G,$B"
echo "${name}=${R},${G},${B}"
}
updateMinttyConfig () {
local config="$1"
local colour="$2"
local name="$3"
local config="${1}"
local color="${2}"
local name="${3}"
sed -i -r -e "s/^${name}=.+/$(createMinttyEntry "${name}" "${colour}")/g" "${config}"
#echo "$(cat < "${config}" | grep -v -e "^${name}=")" > "$config"
#echo -n "$(createMinttyEntry "${name}" "${colour}")" >> "$config"
sed -i -r -e "s/^${name}=.+/$(createMinttyEntry "${name}" "${color}")/g" "${config}"
}
convertNameAndRGBtoITerm() {
local name="$1"
local colour="$2"
set --
set -- $(convertRGBtoMac "$colour")
R=$1; shift; G=$1; shift; B=$1; shift
local name="${1}"
local color="${2}"
set -
set -- $(convertRGBtoMac "${color}")
R=${1}; shift; G=${1}; shift; B=${1}; shift
echo "<key>$1</key><dict><key>Blue Component</key><real>${B}</real><key>Green Component</key><real>${G}</real><key>Red Component</key><real>${R}</real></dict>"
echo "<key>${name}</key><dict><key>Blue Component</key><real>${B}</real><key>Green Component</key><real>${G}</real><key>Red Component</key><real>${R}</real></dict>"
}
dset() {
local key="$1"; shift
local val="$1"
local key="${1}"; shift
local val="${1}"
"$DCONF" write "$PROFILE_KEY/$key" "$val"
"${DCONF}" write "${PROFILE_KEY}/${key}" "${val}"
}
# Because dconf still doesn't have "append"
dlist_append() {
local key="$1"; shift
local val="$1"; shift
local key="${1}"; shift
local val="${1}"; shift
local entries
entries="$(
{
"$DCONF" read "$key" | tr -d "[]" | tr , "\n" | grep -F -v "$val"
echo "'$val'"
"${DCONF}" read "${key}" | tr -d "[]" | tr , "\n" | grep -F -v "${val}"
echo "'${val}'"
} | head -c-1 | tr "\n" ,
)"
"$DCONF" write "$key" "[$entries]"
"${DCONF}" write "${key}" "[${entries}]"
}
gcset() {
local type="$1"; shift
local key="$1"; shift
local val="$1"
local type="${1}"; shift
local key="${1}"; shift
local val="${1}"
"$GCONF" --set --type "$type" "$PROFILE_KEY/$key" -- "$val"
"${GCONF}" --set --type "${type}" "${PROFILE_KEY}/${key}" -- "${val}"
}
# Because gconftool doesn't have "append"
glist_append() {
local type="$1"; shift
local key="$1"; shift
local val="$1"; shift
local type="${1}"; shift
local key="${1}"; shift
local val="${1}"; shift
local entries
entries="$(
{
"$GCONF" --get "$key" | tr -d "[]" | tr , "\n" | grep -F -v "$val"
echo "$val"
"${GCONF}" --get "${key}" | tr -d "[]" | tr , "\n" | grep -F -v "${val}"
echo "${val}"
} | head -c-1 | tr "\n" ,
)"
"$GCONF" --set --type list --list-type "$type" "$key" "[$entries]"
"${GCONF}" --set --type list --list-type "${type}" "${key}" "[${entries}]"
}
gset() {
local key="$1"; shift
local val="$1"
local key="${1}"; shift
local val="${1}"
gsettings set "${PROFILE_KEY}" "${key}" "${val}"
"${GS}" set "${PROFILE_KEY}" "${key}" "${val}"
}
set_theme() {
dset visible-name "'${PROFILE_NAME}'"
dset background-color "'${BACKGROUND_COLOR}'"
dset foreground-color "'${FOREGROUND_COLOR}'"
if [ -n "${BOLD_COLOR}" ]; then
if [[ -n "${BOLD_COLOR:-}" ]]; then
dset bold-color "'${BOLD_COLOR}'"
dset bold-color-same-as-fg "false"
else
dset bold-color "'${COLOR_08}'"
dset bold-color "'${FOREGROUND_COLOR}'"
dset bold-color-same-as-fg "true"
fi
dset use-theme-colors "false"
dset use-theme-background "false"
}
legacy_set_theme() {
gcset string visible_name "${PROFILE_NAME}"
gcset string background_color "${BACKGROUND_COLOR}"
gcset string foreground_color "${FOREGROUND_COLOR}"
if [[ -n "${BOLD_COLOR:-}" ]]; then
gcset string bold_color "${BOLD_COLOR}"
gcset bool bold_color_same_as_fg "false"
else
gcset string bold_color "${FOREGROUND_COLOR}"
gcset bool bold_color_same_as_fg "true"
fi
gcset bool use_theme_colors "false"
gcset bool use_theme_background "false"
}
# |
@ -200,7 +216,7 @@ if [[ "${COLORTERM:-}" == "truecolor" ]] || [[ "${COLORTERM:-}" == "24bit" ]]; t
local color="COLOR_$c"
set -- $(hexRGBtoDecRGB "${!color}")
color_str+="\033[38;2;${1};${2};${3}m█████$(tput sgr0)"
[[ ${GOGH_DRY_RUN:-0} -eq 1 ]] && declare DEMO_COLOR_${c}="\033[38;2;${1};${2};${3}m"
[[ ${GOGH_DRY_RUN:-0} -eq 1 ]] && export "DEMO_COLOR_$c=\033[38;2;${1};${2};${3}m"
[[ "$c" == "08" ]] && color_str+="\n" # new line
done
printf '\n%b\n\n\n' "${color_str}"
@ -222,10 +238,11 @@ fi
# | Print theme colors
# | ===========================================
gogh_colors
[[ ${GOGH_DRY_RUN:-0} -eq 1 ]] && color
# End here if dry run was initiated
[[ ${GOGH_DRY_RUN:-0} -eq 1 ]] && return 0
if [[ ${GOGH_DRY_RUN:-0} -eq 1 ]]; then
color
# End here if dry run was initiated
return 0
fi
apply_elementary() {
@ -243,7 +260,7 @@ apply_cygwin() {
# | Applying values on mintty (cygwin)
# | ===========================================
echo "Patching mintty configuration file (${CFGFILE}) with new colours..."
echo "Patching mintty configuration file (${CFGFILE}) with new colors..."
updateMinttyConfig "$CFGFILE" "$COLOR_01" "Black"
updateMinttyConfig "$CFGFILE" "$COLOR_02" "Red"
@ -263,9 +280,9 @@ apply_cygwin() {
updateMinttyConfig "$CFGFILE" "$COLOR_15" "BoldCyan"
updateMinttyConfig "$CFGFILE" "$COLOR_16" "BoldWhite"
updateMinttyConfig "$CFGFILE" "$BACKGROUND_COLOR" "BackgroundColour"
updateMinttyConfig "$CFGFILE" "$FOREGROUND_COLOR" "ForegroundColour"
updateMinttyConfig "$CFGFILE" "$CURSOR_COLOR" "CursorColour"
updateMinttyConfig "$CFGFILE" "$BACKGROUND_COLOR" "Backgroundcolor"
updateMinttyConfig "$CFGFILE" "$FOREGROUND_COLOR" "Foregroundcolor"
updateMinttyConfig "$CFGFILE" "$CURSOR_COLOR" "Cursorcolor"
echo "Done - please reopen your Cygwin terminal to see the changes"
}
@ -298,7 +315,7 @@ apply_darwin() {
ITERMCOLORS='<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict>'${BACKGROUND_COLOR}${FOREGROUND_COLOR}${COLOR_01}${COLOR_02}${COLOR_03}${COLOR_04}${COLOR_05}${COLOR_06}${COLOR_07}${COLOR_08}${COLOR_09}${COLOR_10}${COLOR_11}${COLOR_12}${COLOR_13}${COLOR_14}${COLOR_15}'</dict></plist>'
# Dump iTerm color scheme to file and import it by opening it
echo "$ITERMCOLORS" > "${PROFILE_NAME}.itermcolors"
echo "${ITERMCOLORS}" > "${PROFILE_NAME}.itermcolors"
open "${PROFILE_NAME}.itermcolors"
rm "${PROFILE_NAME}.itermcolors"
}
@ -308,21 +325,44 @@ apply_gtk() {
# | Applying values to gnome/mate/tilix
# | ===========================================
local legacy="$1"
local legacy="${1:-}"
# This is to avoid doing the profile loop definition twice
if [[ -z "${legacy}" ]]; then
CONFTOOL="${DCONF} read"
VISIBLE_NAME="visible-name"
else
CONFTOOL="${GCONF} --get"
VISIBLE_NAME="visible_name"
fi
# Check first wether profile already exists
profile_hashes=($(${CONFTOOL} "${PROFILE_LIST_KEY}" | tr "[]'," " "))
for profile in "${profile_hashes[@]}"; do
if [[ "$(${CONFTOOL} "${BASE_DIR}${profile}/${VISIBLE_NAME}" | tr -d "'")" == "${PROFILE_NAME}" ]]; then
printf '%s\n' "Profile already exists" "Skipping..."
exit 0
fi
done
# Fallback if there is no default profile
set -- $(${CONFTOOL} ${PROFILE_LIST_KEY} | tr "[]'," " ")
: ${DEFAULT_SLUG:="$1"}
: ${PROFILE_NAME:="Default"}
: ${PROFILE_SLUG:="Default"}
DEFAULT_KEY="${BASE_KEY}/${DEFAULT_SLUG}"
PROFILE_KEY="${BASE_KEY}/${PROFILE_SLUG}"
DEFAULT_KEY="${BASE_DIR}${DEFAULT_SLUG:-}"
PROFILE_KEY="${BASE_DIR}${PROFILE_SLUG:-}"
if [[ -z "${legacy}" ]]; then
if [[ -z "$($DCONF list ${BASE_KEY}/)" ]]; then
if [[ -z "$(${DCONF} list ${BASE_DIR%:})" ]]; then
# Provide a user friendly error text if no saved profile exists, otherwise it will display "Error gconftool not found!"
# it could happen on a newly installed system. (happened on CentOS 7)
echo "Error, no saved profiles found!"
echo "Possible fix, new a profile (Terminal > Edit > Preferences > Profiles > New, then Close) and try again."
echo "You can safely delete the created profile after the installation."
printf '%s\n' \
"Error, no saved profiles found!" \
"Possible fix, new a profile (Terminal > Edit > Preferences > Profiles > New, then Close) and try again." \
"You can safely delete the created profile after the installation."
exit 1
fi
@ -347,28 +387,20 @@ apply_gtk() {
# copy existing settings from default profile
$DCONF dump "${DEFAULT_KEY}/" | $DCONF load "${PROFILE_KEY}/"
echo $DEFAULT_KEY
echo $PROFILE_KEY
# add new copy to global list of profiles
dlist_append "${PROFILE_LIST_KEY}" "${PROFILE_SLUG#:}"
set_theme
dset palette "${LEFT_WRAPPER:-}'${COLOR_01}${PALETTE_DELIM}${COLOR_02}${PALETTE_DELIM}${COLOR_03}${PALETTE_DELIM}${COLOR_04}${PALETTE_DELIM}${COLOR_05}${PALETTE_DELIM}${COLOR_06}${PALETTE_DELIM}${COLOR_07}${PALETTE_DELIM}${COLOR_08}${PALETTE_DELIM}${COLOR_09}${PALETTE_DELIM}${COLOR_10}${PALETTE_DELIM}${COLOR_11}${PALETTE_DELIM}${COLOR_12}${PALETTE_DELIM}${COLOR_13}${PALETTE_DELIM}${COLOR_14}${PALETTE_DELIM}${COLOR_15}${PALETTE_DELIM}${COLOR_16}'${RIGHT_WRAPPER:-}"
dset allow-bold "true" #mate guake
${LEGACY_BOLD:-} && dset allow-bold "true" # mate
else
# Append the Base16 profile to the profile list
glist_append string "${PROFILE_LIST_KEY}" "$PROFILE_SLUG"
glist_append string "${PROFILE_LIST_KEY}" "${PROFILE_SLUG}"
gcset string visible_name "{$PROFILE_NAME}"
legacy_set_theme
gcset string palette "${COLOR_01}:${COLOR_02}:${COLOR_03}:${COLOR_04}:${COLOR_05}:${COLOR_06}:${COLOR_07}:${COLOR_08}:${COLOR_09}:${COLOR_10}:${COLOR_11}:${COLOR_12}:${COLOR_13}:${COLOR_14}:${COLOR_15}:${COLOR_16}"
gcset string background_color "${BACKGROUND_COLOR}"
gcset string foreground_color "${FOREGROUND_COLOR}"
gcset string bold_color "${FOREGROUND_COLOR}"
gcset bool bold_color_same_as_fg "true"
gcset bool use_theme_colors "false"
gcset bool use_theme_background "false"
${LEGACY_BOLD:-} && gcset bool allow-bold "true"
fi
}
@ -377,7 +409,7 @@ apply_guake() {
# | Applying values to guake
# | ===========================================
local legacy="$1"
local legacy="${1:-}"
PROFILE_KEY="/apps/guake/style/font"
if [[ -z "${legacy}" ]]; then
@ -395,22 +427,26 @@ apply_guake() {
}
appy_tilixschemes() {
# |
# | Applying values to tilix colorschemes
# | ===========================================
if [[ ${TILIX_RES::1} =~ ^(y|Y)$ ]]; then
[[ -d "$HOME/.config/tilix/schemes" ]] || mkdir -p "${HOME}/.config/tilix/schemes"
[[ -d "${HOME}/.config/tilix/schemes" ]] || mkdir -p "${HOME}/.config/tilix/schemes"
TILIXCOLORS='{\n\t"name": "'${PROFILE_NAME}'",\n\t"comment": "Generated by Gogh",\n\t"foreground-color": "'${FOREGROUND_COLOR}'",\n\t"background-color":"'${BACKGROUND_COLOR}'",\n\t"cursor-background-color": "'${CURSOR_COLOR}'",\n\t"palette": [\n\t\t"'${COLOR_01}'",\n\t\t"'${COLOR_02}'",\n\t\t"'${COLOR_03}'",\n\t\t"'${COLOR_04}'",\n\t\t"'${COLOR_05}'",\n\t\t"'${COLOR_06}'",\n\t\t"'${COLOR_07}'",\n\t\t"'${COLOR_08}'",\n\t\t"'${COLOR_09}'",\n\t\t"'${COLOR_10}'",\n\t\t"'${COLOR_11}'",\n\t\t"'${COLOR_12}'",\n\t\t"'${COLOR_13}'",\n\t\t"'${COLOR_14}'",\n\t\t"'${COLOR_15}'",\n\t\t"'${COLOR_16}'"\n\t],\n\t"use-badge-color": false,\n\t"use-bold-color": false,\n\t"use-cursor-color": false,\n\t"use-highlight-color": false,\n\t"use-theme-colors": false\n}'
echo -e "$TILIXCOLORS" > "${scratchdir}/${PROFILE_NAME}.json"
echo -e "${TILIXCOLORS}" > "${scratchdir}/${PROFILE_NAME}.json"
# Note: Tilix does not store color scheme name in dconf
# so we have to update color palette for the current profile in order to switch to the new theme
# but only set the palette on the last loop to avoid a flashing terminal
if ((LOOP == OPTLENGTH)); then
cp -f "${scratchdir}"/* "$HOME/.config/tilix/schemes/"
cp -f ${scratchdir}/* "$HOME/.config/tilix/schemes/"
rm -rf "${scratchdir}"
read -r -p "All done - apply new theme? [y/N] " -n 1 TILIX_RES
if [[ ${TILIX_RES::1} =~ ^(y|Y)$ ]]; then
PROFILE_KEY="${BASE_KEY}/${DEFAULT_SLUG}"
PROFILE_NAME="$($DCONF read ${PROFILE_KEY}/visible-name | tr -d \')"
PROFILE_KEY="${BASE_DIR}${DEFAULT_SLUG}"
PROFILE_NAME="$(${DCONF} read ${PROFILE_KEY}/visible-name | tr -d \')"
set_theme
dset palette "['${COLOR_01}', '${COLOR_02}', '${COLOR_03}', '${COLOR_04}', '${COLOR_05}', '${COLOR_06}', '${COLOR_07}', '${COLOR_08}', '${COLOR_09}', '${COLOR_10}', '${COLOR_11}', '${COLOR_12}', '${COLOR_13}', '${COLOR_14}', '${COLOR_15}', '${COLOR_16}']"
fi
@ -445,7 +481,7 @@ case "${TERMINAL}" in
;;
guake )
if [[ -n "$($DCONF list /apps/guake/style/)" ]]; then
if [[ -n "$(${DCONF} list /apps/guake/style/)" ]]; then
apply_guake
else
apply_guake legacy
@ -453,34 +489,37 @@ case "${TERMINAL}" in
;;
gnome-terminal* )
if [[ -n "$($DCONF list /org/gnome/terminal/)" ]]; then
BASE_KEY="/org/gnome/terminal/legacy/profiles:"
PROFILE_LIST_KEY="${BASE_KEY}/list"
PROFILE_SLUG=":${PROFILE_SLUG}"
if [[ -n "$(${DCONF} list /org/gnome/terminal/)" ]]; then
BASE_DIR="/org/gnome/terminal/legacy/profiles:/:"
PROFILE_LIST_KEY="${BASE_DIR%:}list"
PROFILE_SLUG="${PROFILE_SLUG}"
: ${DEFAULT_SLUG:=":$($DCONF read ${BASE_KEY}/default | tr -d \')"}
: ${DEFAULT_SLUG:=":$($DCONF list ${BASE_KEY}/ | grep '/$' | head -n1 | tr -d ':/')"}
echo $PROFILE_SLUG
echo $DEFAULT_SLUG
# Note -- ${BASE_DIR%s} is a workaround to avoid doing additional conditional testing for existing profiles
# if terminal is set to gnome-terminal
: ${DEFAULT_SLUG:="$(${DCONF} read ${BASE_DIR%:}default | tr -d \')"}
LEFT_WRAPPER="["
RIGHT_WRAPPER=]
RIGHT_WRAPPER="]"
PALETTE_DELIM="', '"
apply_gtk
else
BASE_KEY="/apps/gnome-terminal/profiles"
BASE_DIR="/apps/gnome-terminal/profiles/"
PROFILE_LIST_KEY="${BASE_DIR/profiles/global}profile_list"
LEGACY_BOLD=true
: ${DEFAULT_SLUG:="$(${GCONF} read ${BASE_DIR}default_profile)"}
apply_gtk legacy
fi
;;
mate-terminal )
BASE_KEY="/org/mate/terminal/profiles"
PROFILE_LIST_KEY="${BASE_KEY/profiles/global}/profile-list"
BASE_DIR="/org/mate/terminal/profiles/"
PROFILE_LIST_KEY="${BASE_DIR/profiles/global}profile-list"
LEGACY_BOLD=true
: ${DEFAULT_SLUG:="$($DCONF read ${BASE_KEY/profiles/global}/default-profile | tr -d \')"}
: ${DEFAULT_SLUG:="$($DCONF list ${BASE_KEY}/ | grep '/$' | head -n1 | tr -d '/')"}
: ${DEFAULT_SLUG:="$(${DCONF} read ${BASE_DIR/profiles/global}default-profile | tr -d \')"}
PALETTE_DELIM=":"
@ -488,14 +527,13 @@ case "${TERMINAL}" in
;;
tilix )
BASE_KEY="/com/gexperts/Tilix/profiles"
PROFILE_LIST_KEY="${BASE_KEY}/list"
BASE_DIR="/com/gexperts/Tilix/profiles/"
PROFILE_LIST_KEY="${BASE_DIR}list"
: ${DEFAULT_SLUG:="$($DCONF read ${BASE_KEY}/default | tr -d \')"}
: ${DEFAULT_SLUG:="$($DCONF list ${BASE_KEY}/ | grep '/$' | head -n1 | tr -d '/')"}
: ${DEFAULT_SLUG:="$(${DCONF} read ${BASE_DIR}default | tr -d \')"}
LEFT_WRAPPER="["
RIGHT_WRAPPER=]
RIGHT_WRAPPER="]"
PALETTE_DELIM="', '"
appy_tilixschemes
@ -503,7 +541,20 @@ case "${TERMINAL}" in
;;
* )
printf '%s\n' "Unsupported terminal!"
printf '%s\n' \
"Unsupported terminal!" \
"" \
"Supported terminals:" \
" mintty and deriviates" \
" guake" \
" iTerm2" \
" elementary terminal (pantheon/elementary)" \
" mate-terminal" \
" gnome-terminal" \
" tilix" \
"" \
"If you believe you have recieved this message in error," \
"try manually setting \`TERMINAL', hint: ps -h -o comm -p \$PPID"
exit 1
;;

19
gogh.sh
View File

@ -1,7 +1,6 @@
#!/usr/bin/env bash
set -euxo pipefail
set -euo pipefail
export SHELLOPTS
declare -a THEMES=(
'3024-day.sh'
'3024-night.sh'
@ -203,10 +202,12 @@ set_gogh() {
# Evaluate if Gogh was called from local source - i.e cloned repo
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "$SCRIPT_PATH/themes/$1" ]; then
(eval "$SCRIPT_PATH/themes/$1")
# This is to handle dirs with spaces in their names
printf -v SCRIPT_PATH "'%s'" "${SCRIPT_PATH}"
if [[ -e "${SCRIPT_PATH}/themes/$1" ]]; then
(eval "${SCRIPT_PATH}/themes/$1")
else
if [ "$(uname)" = "Darwin" ]; then
if [[ "$(uname)" = "Darwin" ]]; then
# OSX ships with curl
(eval "$(curl -sLo- "${url}")")
else
@ -250,7 +251,7 @@ if [[ ${COLUMNS:-$(tput cols)} -ge 80 ]]; then
gogh_str+=" "
echo -e "${gogh_str}"
printf '%b\n' "${gogh_str}"
#sleep 2.5
else
echo -e "\nGogh\n"
@ -298,9 +299,9 @@ if [[ -z "${TERMINAL:-}" ]]; then
# | Check for the terminal name (depening on os)
# | ===========================================
OS="$(uname)"
if [ "$OS" = "Darwin" ]; then
if [[ "$OS" = "Darwin" ]]; then
TERMINAL=$TERM_PROGRAM
elif [ "${OS#CYGWIN}" != "${OS}" ]; then
elif [[ "${OS#CYGWIN}" != "${OS}" ]]; then
TERMINAL="mintty"
else
# |