aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorakbash <akbash@herdr.dev>2026-07-24 01:28:35 +0300
committerGitHub <noreply@github.com>2026-07-24 01:28:35 +0300
commit503613c8ecbea752a234daf30cb0ad5a8bf93e4e (patch)
tree34b71e4c7055244ed191c043457c572e3ccfc935 /src/app
parent58ad2c6438cf25cdf7e95528c7114d3bf12626d2 (diff)
fix: inherit host palette in pane queries (#1759)
refs #1752 Co-authored-by: Ogulcan Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/agent_resume.rs6
-rw-r--r--src/app/mod.rs35
-rw-r--r--src/app/runtime.rs4
-rw-r--r--src/app/theme_sync.rs15
4 files changed, 57 insertions, 3 deletions
diff --git a/src/app/agent_resume.rs b/src/app/agent_resume.rs
index 408f5983..45a2e3fa 100644
--- a/src/app/agent_resume.rs
+++ b/src/app/agent_resume.rs
@@ -410,6 +410,7 @@ mod tests {
g: 20,
b: 20,
}),
+ ..Default::default()
};
assert!(app.start_pending_agent_resumes(false));
@@ -511,6 +512,7 @@ mod tests {
g: 20,
b: 20,
}),
+ ..Default::default()
};
for terminal_id in [&active_terminal, &hidden_terminal] {
app.state
@@ -575,6 +577,7 @@ mod tests {
g: 20,
b: 20,
}),
+ ..Default::default()
};
app.state
.terminals
@@ -635,6 +638,7 @@ mod tests {
g: 20,
b: 20,
}),
+ ..Default::default()
};
app.state
.terminals
@@ -692,6 +696,7 @@ mod tests {
g: 20,
b: 20,
}),
+ ..Default::default()
};
app.state
.terminals
@@ -752,6 +757,7 @@ mod tests {
g: 20,
b: 20,
}),
+ ..Default::default()
};
app.state
.terminals
diff --git a/src/app/mod.rs b/src/app/mod.rs
index b56c128c..f6dbe261 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -1702,6 +1702,11 @@ impl App {
self.update_host_terminal_theme(kind, color);
}
}
+ crate::raw_input::RawInputEvent::HostPaletteColors { colors } => {
+ if apply_host_terminal_theme {
+ self.update_host_terminal_palette_colors(&colors);
+ }
+ }
crate::raw_input::RawInputEvent::HostColorSchemeChanged(appearance) => {
if apply_host_terminal_theme {
self.set_host_terminal_appearance(appearance, true);
@@ -5797,7 +5802,7 @@ last_pane = "prefix+tab"
fn route_client_input_updates_host_terminal_theme_from_osc_response() {
let mut app = test_app();
- app.route_client_input(b"\x1b]11;#123456\x07".to_vec());
+ app.route_client_input(b"\x1b]11;#123456\x07\x1b]4;7;rgb:aaaa/bbbb/cccc\x1b\\".to_vec());
assert_eq!(
app.state.host_terminal_theme.background,
@@ -5807,6 +5812,34 @@ last_pane = "prefix+tab"
b: 0x56,
})
);
+ assert_eq!(
+ app.state.host_terminal_theme.palette[7],
+ Some(crate::terminal_theme::RgbColor {
+ r: 0xaa,
+ g: 0xbb,
+ b: 0xcc,
+ })
+ );
+
+ app.route_client_input(crate::raw_input::GHOSTTY_COLOR_SCHEME_DARK_REPORT.to_vec());
+ assert_eq!(
+ app.state.host_terminal_theme.palette[7],
+ Some(crate::terminal_theme::RgbColor {
+ r: 0xaa,
+ g: 0xbb,
+ b: 0xcc,
+ })
+ );
+
+ app.route_client_input(b"\x1b]4;7;rgb:dddd/eeee/ffff\x1b\\".to_vec());
+ assert_eq!(
+ app.state.host_terminal_theme.palette[7],
+ Some(crate::terminal_theme::RgbColor {
+ r: 0xdd,
+ g: 0xee,
+ b: 0xff,
+ })
+ );
}
#[tokio::test]
diff --git a/src/app/runtime.rs b/src/app/runtime.rs
index 269de37d..97054f4b 100644
--- a/src/app/runtime.rs
+++ b/src/app/runtime.rs
@@ -224,6 +224,9 @@ impl App {
crate::raw_input::RawInputEvent::HostDefaultColor { kind, color } => {
self.update_host_terminal_theme(kind, color)
}
+ crate::raw_input::RawInputEvent::HostPaletteColors { colors } => {
+ self.update_host_terminal_palette_colors(&colors)
+ }
crate::raw_input::RawInputEvent::HostColorSchemeChanged(appearance) => {
self.query_host_terminal_theme();
self.set_host_terminal_appearance(appearance, true)
@@ -1131,6 +1134,7 @@ mod tests {
g: 20,
b: 20,
}),
+ ..Default::default()
};
let terminal_id = app.state.workspaces[0]
.terminal_id(pane_id)
diff --git a/src/app/theme_sync.rs b/src/app/theme_sync.rs
index 392d6f59..c41ca24c 100644
--- a/src/app/theme_sync.rs
+++ b/src/app/theme_sync.rs
@@ -6,8 +6,8 @@ impl App {
pub(super) fn query_host_terminal_theme(&self) {
use std::io::Write;
- let _ = std::io::stdout()
- .write_all(crate::terminal_theme::HOST_COLOR_QUERY_SEQUENCE.as_bytes());
+ let query = crate::terminal_theme::host_terminal_theme_query_sequence();
+ let _ = std::io::stdout().write_all(query.as_bytes());
let _ = std::io::stdout().flush();
}
@@ -26,6 +26,17 @@ impl App {
changed | self.set_host_terminal_theme(next_theme)
}
+ pub(super) fn update_host_terminal_palette_colors(
+ &mut self,
+ colors: &[(u8, crate::terminal_theme::RgbColor)],
+ ) -> bool {
+ let mut next_theme = self.state.host_terminal_theme;
+ for &(index, color) in colors {
+ next_theme = next_theme.with_palette_color(index, color);
+ }
+ self.set_host_terminal_theme(next_theme)
+ }
+
pub(super) fn set_host_terminal_appearance(
&mut self,
appearance: crate::terminal_theme::HostAppearance,