// Copyright (c) 2026 Storm Dragon // Authors: Storm Dragon, Angus Kola // SPDX-License-Identifier: GPL-3.0-or-later package app import ( "strings" "git.stormux.org/storm/cthulhu/internal/atspi" ) // A window-manager switcher can leave the old client as X11 foreground while // Alt is held. Present its selection without replacing that client's focus, // review position, browser mode or native ownership. No session state is kept. func (handler *accessibilityEventHandler) handle_window_switcher(event atspi.Event) bool { if !atspi.IsWindowSwitcherSelection(event) { return false } if handler.focusGate.InternalUIActive() || handler.foreground != nil && event.Foreground.Epoch != handler.state.foregroundState.Epoch { return true } if title := strings.TrimSpace(event.Source.Name); title != "" { // The system role also flashes the title on Braille through outputQueue. // Normal input interruption and FIFO speech policy still apply. handler.speech.Enqueue(speechRequest{Text: title, Role: "system", Cause: "window-switcher", BypassFocusGate: true}) } return true }