Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

feat(gui): add a red app icon

RoversX2ef60a0f210e
diff --git a/assets/icon/ThinkTerm_red.icns b/assets/icon/ThinkTerm_red.icns
new file mode 100644
index 00000000..b2b896a9
Binary files /dev/null and b/assets/icon/ThinkTerm_red.icns differ
diff --git a/assets/icon/ThinkTerm_red_128.png b/assets/icon/ThinkTerm_red_128.png
new file mode 100644
index 00000000..567e1846
Binary files /dev/null and b/assets/icon/ThinkTerm_red_128.png differ
diff --git a/assets/icon/update.sh b/assets/icon/update.sh
index b85943e6..800db8ad 100755
--- a/assets/icon/update.sh
+++ b/assets/icon/update.sh
@@ -8,6 +8,7 @@ src=ThinkTerm_simple.png
windows_src=ThinkTerm_windows.png
macos_icns=ThinkTerm_simple.icns
classic_macos_icns=ThinkTerm.icns
+red_macos_icns=ThinkTerm_red.icns
conv_opts="-colors 256 -background none -density 300"
@@ -35,6 +36,17 @@ if [ -f "$macos_icns" ]; then
sips -z 128 128 -s format png "$classic_macos_icns" --out ThinkTerm_128.png
fi
fi
+ # The red icon is the default one with red and blue swapped.
+ if command -v iconutil >/dev/null 2>&1 ; then
+ rm -rf red.iconset && iconutil -c iconset "$macos_icns" -o red.iconset
+ for png in red.iconset/*.png ; do
+ convert "$png" -channel-fx 'red<=>blue' "$png"
+ done
+ iconutil -c icns red.iconset -o "$red_macos_icns"
+ rm -rf red.iconset
+ cp "$red_macos_icns" ../macos/ThinkTerm.app/Contents/Resources/ThinkTerm_red.icns
+ sips -z 128 128 -s format png "$red_macos_icns" --out ThinkTerm_red_128.png
+ fi
else
png2icns ../macos/ThinkTerm.app/Contents/Resources/ThinkTerm_simple.icns icon_*px.png
fi
diff --git a/assets/macos/ThinkTerm.app/Contents/Resources/ThinkTerm_red.icns b/assets/macos/ThinkTerm.app/Contents/Resources/ThinkTerm_red.icns
new file mode 100644
index 00000000..b2b896a9
Binary files /dev/null and b/assets/macos/ThinkTerm.app/Contents/Resources/ThinkTerm_red.icns differ
diff --git a/ci/check-privacy.py b/ci/check-privacy.py
index 09532659..842963fc 100644
--- a/ci/check-privacy.py
+++ b/ci/check-privacy.py
@@ -24,6 +24,7 @@ UPSTREAM_USERS = {
APP_TEMPLATE = {
"assets/macos/ThinkTerm.app/Contents/Info.plist",
"assets/macos/ThinkTerm.app/Contents/Resources/ThinkTerm.icns",
+ "assets/macos/ThinkTerm.app/Contents/Resources/ThinkTerm_red.icns",
"assets/macos/ThinkTerm.app/Contents/Resources/ThinkTerm_simple.icns",
"assets/macos/ThinkTerm.app/Contents/Resources/terminal.icns",
"assets/macos/ThinkTerm.app/libEGL.dylib",
diff --git a/thinkterm-i18n/i18n/de-DE.ftl b/thinkterm-i18n/i18n/de-DE.ftl
index 3e85dd74..45701426 100644
--- a/thinkterm-i18n/i18n/de-DE.ftl
+++ b/thinkterm-i18n/i18n/de-DE.ftl
@@ -130,7 +130,8 @@ settings-windows-backdrop-accent = Methode 1
settings-windows-backdrop-system = Methode 2
settings-windows-backdrop-system-blur = Methode 3
settings-badge-beta = Beta
-settings-app-icon-simple = Schlicht
+settings-app-icon-simple = Blaue Pille
+settings-app-icon-red = Rote Pille
settings-app-icon-classic = Klassisch
settings-effective-color-scheme = Aktives Farbschema
settings-effective-color-scheme-description = Die Farben des Terminals. Zum Auswählen klicken.
diff --git a/thinkterm-i18n/i18n/en-US.ftl b/thinkterm-i18n/i18n/en-US.ftl
index c4cb1a7b..c6b8f729 100644
--- a/thinkterm-i18n/i18n/en-US.ftl
+++ b/thinkterm-i18n/i18n/en-US.ftl
@@ -130,7 +130,8 @@ settings-windows-backdrop-accent = Way 1
settings-windows-backdrop-system = Way 2
settings-windows-backdrop-system-blur = Way 3
settings-badge-beta = Beta
-settings-app-icon-simple = Simple
+settings-app-icon-simple = Blue Pill
+settings-app-icon-red = Red Pill
settings-app-icon-classic = Classic
settings-effective-color-scheme = Effective Color Scheme
settings-effective-color-scheme-description = What the terminal is painted in. Click to choose.
diff --git a/thinkterm-i18n/i18n/fr-FR.ftl b/thinkterm-i18n/i18n/fr-FR.ftl
index dd1a5aff..34d7e980 100644
--- a/thinkterm-i18n/i18n/fr-FR.ftl
+++ b/thinkterm-i18n/i18n/fr-FR.ftl
@@ -130,7 +130,8 @@ settings-windows-backdrop-accent = Méthode 1
settings-windows-backdrop-system = Méthode 2
settings-windows-backdrop-system-blur = Méthode 3
settings-badge-beta = Bêta
-settings-app-icon-simple = Simple
+settings-app-icon-simple = Pilule bleue
+settings-app-icon-red = Pilule rouge
settings-app-icon-classic = Classique
settings-effective-color-scheme = Jeu de couleurs actif
settings-effective-color-scheme-description = Les couleurs du terminal. Cliquez pour choisir.
diff --git a/thinkterm-i18n/i18n/ja-JP.ftl b/thinkterm-i18n/i18n/ja-JP.ftl
index 42fc924a..356c705a 100644
--- a/thinkterm-i18n/i18n/ja-JP.ftl
+++ b/thinkterm-i18n/i18n/ja-JP.ftl
@@ -127,7 +127,8 @@ settings-windows-backdrop-accent = 方法 1
settings-windows-backdrop-system = 方法 2
settings-windows-backdrop-system-blur = 方法 3
settings-badge-beta = ベータ
-settings-app-icon-simple = シンプル
+settings-app-icon-simple = 青いピル
+settings-app-icon-red = 赤いピル
settings-app-icon-classic = クラシック
settings-effective-color-scheme = 有効なカラースキーム
settings-effective-color-scheme-description = ターミナルの配色です。クリックで選択します。
diff --git a/thinkterm-i18n/i18n/zh-CN.ftl b/thinkterm-i18n/i18n/zh-CN.ftl
index ffb6b3be..51807ad0 100644
--- a/thinkterm-i18n/i18n/zh-CN.ftl
+++ b/thinkterm-i18n/i18n/zh-CN.ftl
@@ -127,7 +127,8 @@ settings-windows-backdrop-accent = 方式一
settings-windows-backdrop-system = 方式二
settings-windows-backdrop-system-blur = 方式三
settings-badge-beta = Beta
-settings-app-icon-simple = 简约
+settings-app-icon-simple = 蓝色药丸
+settings-app-icon-red = 红色药丸
settings-app-icon-classic = 经典
settings-effective-color-scheme = 当前配色方案
settings-effective-color-scheme-description = 终端当前用的配色。点击选择。
diff --git a/wezterm-gui/src/native_settings.rs b/wezterm-gui/src/native_settings.rs
index 561e9339..f4349892 100644
--- a/wezterm-gui/src/native_settings.rs
+++ b/wezterm-gui/src/native_settings.rs
@@ -128,6 +128,8 @@ where
#[serde(rename_all = "lowercase")]
pub(crate) enum NativeAppIcon {
Simple,
+ /// The simple one, red.
+ Red,
#[serde(alias = "default")]
Classic,
}
@@ -141,7 +143,8 @@ impl Default for NativeAppIcon {
impl NativeAppIcon {
pub(crate) fn label(self) -> &'static str {
match self {
- Self::Simple => "Simple",
+ Self::Simple => "Blue Pill",
+ Self::Red => "Red Pill",
Self::Classic => "Classic",
}
}
@@ -149,17 +152,19 @@ impl NativeAppIcon {
fn file_name(self) -> &'static str {
match self {
Self::Simple => "ThinkTerm_simple.icns",
+ Self::Red => "ThinkTerm_red.icns",
Self::Classic => "ThinkTerm.icns",
}
}
- pub(crate) const ALL: [Self; 2] = [Self::Simple, Self::Classic];
+ pub(crate) const ALL: [Self; 3] = [Self::Simple, Self::Red, Self::Classic];
/// A 128px copy of the icon, for Settings to show as a choice: the
/// full-size art is megabytes of PNG to decode for a 44pt picture.
pub(crate) fn thumbnail(self) -> &'static [u8] {
match self {
Self::Simple => include_bytes!("../../assets/icon/ThinkTerm_simple_128.png"),
+ Self::Red => include_bytes!("../../assets/icon/ThinkTerm_red_128.png"),
Self::Classic => include_bytes!("../../assets/icon/ThinkTerm_128.png"),
}
}
@@ -405,6 +410,9 @@ impl NativeBottomQuoteMode {
pub(crate) struct NativeAppearanceSettings {
#[serde(deserialize_with = "theme_mode_or_default")]
pub(crate) theme_mode: NativeThemeMode,
+ /// A build without the icon a newer one chose falls back to the
+ /// default rather than failing the file, as with the theme.
+ #[serde(deserialize_with = "choice_or_default")]
pub(crate) app_icon: NativeAppIcon,
/// Color scheme picked in the command palette; overrides the config's
/// `color_scheme` for every window. `None` follows the configuration.
@@ -3043,6 +3051,24 @@ mod tests {
/// The mouse and clipboard choices too: a typo, or a newer build's
/// value, costs that one field and nothing else; a field this build no
/// longer has is passed over.
+ #[test]
+ fn an_unknown_app_icon_does_not_take_the_rest_with_them() {
+ let json = r#"{
+ "version": 1,
+ "appearance": { "theme_mode": "light", "app_icon": "green" },
+ "localization": { "language": "ja-JP" }
+ }"#;
+ let settings: ThinkTermNativeSettings =
+ serde_json::from_str(json).expect("the file has to survive");
+ assert_eq!(settings.appearance.app_icon, NativeAppIcon::default());
+ assert_eq!(settings.appearance.theme_mode, NativeThemeMode::Light);
+ assert_eq!(settings.localization.language.as_deref(), Some("ja-JP"));
+
+ let json = r#"{ "version": 1, "appearance": { "app_icon": "red" } }"#;
+ let settings: ThinkTermNativeSettings = serde_json::from_str(json).unwrap();
+ assert_eq!(settings.appearance.app_icon, NativeAppIcon::Red);
+ }
+
#[test]
fn unknown_mouse_and_clipboard_choices_do_not_take_the_rest_with_them() {
let json = r#"{
diff --git a/wezterm-gui/src/settings_window.rs b/wezterm-gui/src/settings_window.rs
index 619a6f04..06769ab8 100644
--- a/wezterm-gui/src/settings_window.rs
+++ b/wezterm-gui/src/settings_window.rs
@@ -1454,6 +1454,7 @@ fn localized_theme_mode_label(mode: NativeThemeMode) -> String {
fn localized_app_icon_label(icon: NativeAppIcon) -> String {
crate::i18n::tr(match icon {
NativeAppIcon::Simple => "settings-app-icon-simple",
+ NativeAppIcon::Red => "settings-app-icon-red",
NativeAppIcon::Classic => "settings-app-icon-classic",
})
}
@@ -9055,7 +9056,21 @@ impl SettingsWindow {
self.paint_separator(layers, x, y - self.ui_px(28.0), width)?;
}
let side = self.ui_px(88.0).round();
- let gap = self.ui_px(20.0);
+ let labels = NativeAppIcon::ALL.map(localized_app_icon_label);
+ let widest = labels
+ .iter()
+ .map(|label| self.measure_text_width(&body_font, label))
+ .fold(0.0, f32::max);
+ let count = NativeAppIcon::ALL.len() as f32;
+ let spacing = self.ui_px(12.0);
+ // Every name gets the room of the widest, so none is cut off --
+ // unless the names would then take over half the row: in a narrow
+ // window they end in an ellipsis rather than crowd out the title.
+ let label_room = widest.min(((width * 0.5 - spacing * (count - 1.0)) / count).max(side));
+ // Names a little apart; wide ones spread the icons.
+ let gap = self.ui_px(20.0).max(label_room + spacing - side).ceil();
+ // How far a name wider than its icon hangs past it, on each side.
+ let overhang = ((label_room - side) / 2.0).max(0.0).ceil();
// The artwork keeps the macOS icon grid's margin: 13 of every 128
// pixels on each side are clear, and the ring hugs what is drawn.
let inset = (side * 13.0 / 128.0).round();
@@ -9064,12 +9079,10 @@ impl SettingsWindow {
let cell_height = self.metrics.cell_size.height as f32;
let chosen = self.native_settings.appearance.app_icon;
let accent = self.chrome_palette.accent;
- let count = NativeAppIcon::ALL.len() as f32;
- let block_x = x + width - side * count - gap * (count - 1.0);
+ let block_x = x + width - overhang - side * count - gap * (count - 1.0);
// The drawn face's top lines up with the label's.
let icon_y = y - inset;
let label_y = icon_y + side - inset + self.ui_px(10.0);
- let label_room = side + gap * 0.8;
for (index, icon) in NativeAppIcon::ALL.iter().copied().enumerate() {
let icon_x = block_x + (side + gap) * index as f32;
@@ -9094,7 +9107,7 @@ impl SettingsWindow {
)?;
}
self.draw_app_icon_choice(layers, icon, icon_x, icon_y, side)?;
- let label = localized_app_icon_label(icon);
+ let label = &labels[index];
let label_width = self.measure_text_width(&body_font, &label).min(label_room);
self.draw_text(
layers,
@@ -9117,7 +9130,7 @@ impl SettingsWindow {
);
}
- let text_width = (block_x - x - self.ui_px(24.0)).max(0.0);
+ let text_width = (block_x - overhang - x - self.ui_px(24.0)).max(0.0);
self.draw_text(
layers,
&ui_font,