From 7dd2004da7357ad69ce8c8850cbe7daa88a91465 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Mon, 1 Dec 2025 12:41:02 +0100 Subject: [PATCH] Re-enable focus reporting on non-tmux I can no longer reproduce the issue described in bdd478bbd0f (Disable focus reporting on non-tmux again for now, 2024-04-18). Maybe the TTY handoff changes fixed this. Let's remove this workaround and enable focus reporting everywhere. --- CHANGELOG.rst | 2 ++ src/tty_handoff.rs | 14 ++------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b9762f45d..c3489b55a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -19,6 +19,8 @@ Improved terminal support ------------------------- - OSC 133 prompt markers now also mark the prompt end, which improves shell integration with terminals like iTerm2 (:issue:`11837`). - Operating-system-specific key bindings are now decided based on the :ref:`terminal's host OS `. +- Focus reporting is enabled unconditionally, not just inside tmux. + To use it, define functions that handle the ``fish_focus_in`` or ``fish_focus_out`` :ref:`events `. - New :ref:`feature flag ` ``omit-term-workarounds`` can be turned on to prevent fish from trying to work around incompatible terminals. For distributors and developers diff --git a/src/tty_handoff.rs b/src/tty_handoff.rs index a33881485..c754d21bc 100644 --- a/src/tty_handoff.rs +++ b/src/tty_handoff.rs @@ -64,8 +64,6 @@ pub enum TtyQuirks { PreCsiMidnightCommander, // Running in iTerm2 before 3.5.12, which causes issues when using the kitty keyboard protocol. PreKittyIterm2, - // Whether we are running under tmux. - Tmux, // Whether we are running under WezTerm. Wezterm, } @@ -80,8 +78,6 @@ fn detect(vars: &dyn Environment, xtversion: &wstr) -> Self { PreCsiMidnightCommander } else if get_iterm2_version(xtversion).is_some_and(|v| v < (3, 5, 12)) { PreKittyIterm2 - } else if xtversion.starts_with(L!("tmux ")) { - Tmux } else if xtversion.starts_with(L!("WezTerm ")) { Wezterm } else { @@ -176,14 +172,8 @@ fn safe_get_supported_protocol(&self) -> ProtocolKind { // Return the protocols set to enable or disable TTY protocols. fn get_protocols(self) -> TtyProtocolsSet { - let mut on_chain = vec![DecsetBracketedPaste]; - let mut off_chain = vec![DecrstBracketedPaste]; - - // Enable focus reporting under tmux - if self == TtyQuirks::Tmux { - on_chain.push(DecsetFocusReporting); - off_chain.push(DecrstFocusReporting); - } + let on_chain = vec![DecsetFocusReporting, DecsetBracketedPaste]; + let off_chain = vec![DecrstFocusReporting, DecrstBracketedPaste]; let on_chain = || on_chain.clone().into_iter(); let off_chain = || off_chain.clone().into_iter();