diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-04-05 02:24:57 +0300 |
|---|---|---|
| committer | Can Celik <ogulcancelik@gmail.com> | 2026-04-05 02:32:00 +0300 |
| commit | a08dfaef2f13873fc85dc9e1357235b8b0703a46 (patch) | |
| tree | a34a2ada492da80f5efe67eab08b34c3ca249a07 /src/app/mod.rs | |
| parent | 19239c6c87f190a38796b6d7a2e15620a97b70b7 (diff) | |
feat: forward ghostty pane focus events on focus changes
Diffstat (limited to 'src/app/mod.rs')
| -rw-r--r-- | src/app/mod.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/app/mod.rs b/src/app/mod.rs index 914c6ca4..b53024b1 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -738,7 +738,13 @@ impl App { return; } + #[cfg(feature = "ghostty-vt")] + if let Some((ws_idx, pane_id)) = self.last_focus { + self.send_pane_focus_event(ws_idx, pane_id, crate::ghostty::FocusEvent::Lost); + } if let Some((ws_idx, pane_id)) = current_focus { + #[cfg(feature = "ghostty-vt")] + self.send_pane_focus_event(ws_idx, pane_id, crate::ghostty::FocusEvent::Gained); self.emit_event(crate::api::schema::EventEnvelope { event: crate::api::schema::EventKind::WorkspaceFocused, data: crate::api::schema::EventData::WorkspaceFocused { @@ -770,6 +776,24 @@ impl App { self.last_focus = current_focus; } + #[cfg(feature = "ghostty-vt")] + fn send_pane_focus_event( + &self, + ws_idx: usize, + pane_id: crate::layout::PaneId, + event: crate::ghostty::FocusEvent, + ) { + let Some(runtime) = self + .state + .workspaces + .get(ws_idx) + .and_then(|ws| ws.runtime(pane_id)) + else { + return; + }; + runtime.try_send_focus_event(event); + } + fn find_pane( &self, pane_id: crate::layout::PaneId, |
