Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add termux #477

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 62 additions & 1 deletion apply-colors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ if [[ -z "${TERMINAL:-}" ]]; then
TERMINAL="mintty"
elif [[ "${TERM}" = "linux" ]]; then
TERMINAL="linux"
elif [[ "${HOME}" = *com.termux* ]]; then
TERMINAL="termux"
else
# |
# | Depending on how the script was invoked, we need
Expand Down Expand Up @@ -203,6 +205,11 @@ case "${TERMINAL}" in
exit 1
fi
;;

termux )
CFGFILE="${HOME}/.termux/colors.properties"
echo > "${CFGFILE}"
;;
esac


Expand Down Expand Up @@ -291,6 +298,14 @@ updateFootConfig () {
sed -i -r -e "s/^${name}=.*/${name}=${color/\#/}/g" "${config}"
}

updateTermuxConfig() {
local config="${1}"
local color="${2,,}"
local name="${3}"

echo "${name}=${color}" >> "${config}"
}

createKonsoleEntry () {
local name="${1}"
local color="${2}"
Expand Down Expand Up @@ -648,7 +663,7 @@ apply_kitty() {

CFGFILE="${KITTY_CONFIG_DIRECTORY}/$COLOR_FILE"

pirnts "Updating color theme file ($CFGFILE) with theme..."
prints "Updating color theme file ($CFGFILE) with theme..."

rm -f "$CFGFILE"

Expand Down Expand Up @@ -1076,6 +1091,47 @@ apply_linux_vt () {
fi
}

apply_termux() {

updateTermuxConfig "$CFGFILE" "$BACKGROUND_COLOR" "background"
updateTermuxConfig "$CFGFILE" "$FOREGROUND_COLOR" "foreground"

updateTermuxConfig "$CFGFILE" "$CURSOR_COLOR" "cursor"

updateTermuxConfig "$CFGFILE" "$COLOR_01" "color0"
updateTermuxConfig "$CFGFILE" "$COLOR_02" "color1"
updateTermuxConfig "$CFGFILE" "$COLOR_03" "color2"
updateTermuxConfig "$CFGFILE" "$COLOR_04" "color3"
updateTermuxConfig "$CFGFILE" "$COLOR_05" "color4"
updateTermuxConfig "$CFGFILE" "$COLOR_06" "color5"
updateTermuxConfig "$CFGFILE" "$COLOR_07" "color6"
updateTermuxConfig "$CFGFILE" "$COLOR_08" "color7"
updateTermuxConfig "$CFGFILE" "$COLOR_09" "color8"

updateTermuxConfig "$CFGFILE" "$COLOR_10" "color9"
updateTermuxConfig "$CFGFILE" "$COLOR_11" "color10"
updateTermuxConfig "$CFGFILE" "$COLOR_12" "color11"
updateTermuxConfig "$CFGFILE" "$COLOR_13" "color12"
updateTermuxConfig "$CFGFILE" "$COLOR_14" "color13"
updateTermuxConfig "$CFGFILE" "$COLOR_15" "color14"
updateTermuxConfig "$CFGFILE" "$COLOR_16" "color15"

local res
if [[ -z "${GOGH_NONINTERACTIVE+no}" ]] && [[ -z "${GOGH_USE_NEW_THEME+no}" ]]; then
read -r -p "All done - apply new theme? [y/N] " -n 1
res="${REPLY}"
unset REPLY
elif [[ ! -z "${GOGH_USE_NEW_THEME+yes}" ]]; then
res="Y"
else
res="N"
fi

if [[ "${res}" =~ ^(y|Y) ]]; then
termux-reload-settings || true
fi
}

[[ -n "${UUIDGEN}" ]] && PROFILE_SLUG="$(uuidgen)"

case "${TERMINAL}" in
Expand Down Expand Up @@ -1188,6 +1244,10 @@ case "${TERMINAL}" in
apply_linux_vt
;;

termux )
apply_termux
;;

* )
printserr "Unsupported terminal!" \
"" \
Expand All @@ -1208,6 +1268,7 @@ case "${TERMINAL}" in
" konsole" \
" linux (linux vt)" \
" terminator" \
" termux" \
"" \
"If you believe you have received this message in error," \
"try manually setting env \`TERMINAL' with the value above." \
Expand Down
2 changes: 2 additions & 0 deletions gogh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,8 @@ if [[ -z "${TERMINAL:-}" ]]; then
TERMINAL="kitty"
elif [[ "${TERM}" = "linux" ]]; then
TERMINAL="linux"
elif [[ "${HOME}" = *com.termux* ]]; then
TERMINAL="termux"
else
# |
# | Depending on how the script was invoked, we need
Expand Down