Skip to content

Commit 4396e8f

Browse files
authored
Merge pull request #499 from carlesso/master
Add Wezterm terminal support
2 parents bd8aaf6 + 829f52b commit 4396e8f

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ Here are some terminals that Gogh is supported with:
184184
- Mintty - [Web](https://mintty.github.io/)
185185
- Pantheon / Elementary - [Web](https://github.com/elementary/terminal)
186186
- Tilix - [Web](https://gnunn1.github.io/tilix-web/)
187+
- Wezterm - [Web](https://wezterm.org/)
187188
- XFCE4 - [Web](https://docs.xfce.org/apps/terminal/start)
188189
- Terminator - [Web](https://github.com/gnome-terminator/terminator)
189190

apply-colors.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ if [[ -z "${TERMINAL:-}" ]]; then
8080
OS="$(uname)"
8181
if [[ "$TERM" = "xterm-kitty" ]]; then
8282
TERMINAL="kitty"
83+
elif [[ "$TERM_PROGRAM" = "WezTerm" ]]; then
84+
TERMINAL="wezterm"
8385
elif [[ "$OS" = "Darwin" ]]; then
8486
TERMINAL=$TERM_PROGRAM
8587
elif [[ "${OS#CYGWIN}" != "${OS}" ]]; then
@@ -1132,6 +1134,49 @@ apply_termux() {
11321134
fi
11331135
}
11341136

1137+
apply_wezterm() {
1138+
# |
1139+
# | Applying values on Wezterm using Dynamic Color Escape Sequences
1140+
# | ===========================================
1141+
1142+
prints "Applying Wezterm color theme using dynamic color escape sequences..."
1143+
1144+
# Build the color palette escape sequence
1145+
# Format: \033]4;0;color0;1;color1;...;15;color15\007
1146+
local palette_seq="\\033]4"
1147+
palette_seq="${palette_seq};0;${COLOR_01}"
1148+
palette_seq="${palette_seq};1;${COLOR_02}"
1149+
palette_seq="${palette_seq};2;${COLOR_03}"
1150+
palette_seq="${palette_seq};3;${COLOR_04}"
1151+
palette_seq="${palette_seq};4;${COLOR_05}"
1152+
palette_seq="${palette_seq};5;${COLOR_06}"
1153+
palette_seq="${palette_seq};6;${COLOR_07}"
1154+
palette_seq="${palette_seq};7;${COLOR_08}"
1155+
palette_seq="${palette_seq};8;${COLOR_09}"
1156+
palette_seq="${palette_seq};9;${COLOR_10}"
1157+
palette_seq="${palette_seq};10;${COLOR_11}"
1158+
palette_seq="${palette_seq};11;${COLOR_12}"
1159+
palette_seq="${palette_seq};12;${COLOR_13}"
1160+
palette_seq="${palette_seq};13;${COLOR_14}"
1161+
palette_seq="${palette_seq};14;${COLOR_15}"
1162+
palette_seq="${palette_seq};15;${COLOR_16}\\007"
1163+
1164+
# Apply the color palette
1165+
printf "${palette_seq}"
1166+
1167+
# Set foreground color (escape sequence 10)
1168+
printf "\\033]10;${FOREGROUND_COLOR}\\007"
1169+
1170+
# Set background color (escape sequence 11)
1171+
printf "\\033]11;${BACKGROUND_COLOR}\\007"
1172+
1173+
# Set cursor color (escape sequence 12)
1174+
printf "\\033]12;${CURSOR_COLOR}\\007"
1175+
1176+
prints "Done - Wezterm colors have been applied dynamically."
1177+
prints "Theme: ${PROFILE_NAME}"
1178+
}
1179+
11351180
[[ -n "${UUIDGEN}" ]] && PROFILE_SLUG="$(uuidgen)"
11361181

11371182
case "${TERMINAL}" in
@@ -1248,6 +1293,10 @@ case "${TERMINAL}" in
12481293
apply_termux
12491294
;;
12501295

1296+
wezterm )
1297+
apply_wezterm
1298+
;;
1299+
12511300
* )
12521301
printserr "Unsupported terminal!" \
12531302
"" \
@@ -1269,6 +1318,7 @@ case "${TERMINAL}" in
12691318
" linux (linux vt)" \
12701319
" terminator" \
12711320
" termux" \
1321+
" wezterm" \
12721322
"" \
12731323
"If you believe you have received this message in error," \
12741324
"try manually setting env \`TERMINAL' with the value above." \

0 commit comments

Comments
 (0)