From 295eaa8f632618ca1b0b31bcee5766fd81caa689 Mon Sep 17 00:00:00 2001 From: Niklas Herder Date: Sat, 12 Sep 2026 09:22:50 +0200 Subject: [PATCH] cursor: hide while typing and after touch input MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Typing hides on a real keystroke only — a bare modifier press is excluded so Super+drag keeps its cursor. Touch hides until the pointer next moves, which the reveal rule enforces via HideReason::Touch. Drafted with Claude (Anthropic); reviewed and tested by the committer. --- src/input/mod.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/input/mod.rs b/src/input/mod.rs index 05fa1205..6cac7cdf 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -339,6 +339,26 @@ impl State { keyboard.modifier_state().num_lock; } } + + // A bare modifier press changes the modifier state; a real + // keystroke does not. Super+drag moves windows, so hiding on + // Super-down would take the cursor away exactly as the user + // reaches for it. Super+1 still counts as typing. + let bare_modifier = previous_modifiers != keyboard.modifier_state(); + if self.common.config.cosmic_conf.cursor_hide.while_typing + && state == KeyState::Pressed + && !bare_modifier + { + crate::backend::render::cursor::hide_cursor_now( + self, + &seat, + crate::backend::render::cursor::HideReason::Typing, + ); + } else { + // Still refresh: this is how entering fullscreen by + // keyboard arms the fullscreen timeout. + crate::backend::render::cursor::refresh_idle_timer(self, &seat); + } } } @@ -1496,6 +1516,14 @@ impl State { time: event.time(), }, ); + + if self.common.config.cosmic_conf.cursor_hide.after_touch { + crate::backend::render::cursor::hide_cursor_now( + self, + &seat, + crate::backend::render::cursor::HideReason::Touch, + ); + } } } InputEvent::TouchMotion { event, .. } => {