Theia API Documentation v1.71.0
    Preparing search index...

    Tracks focus state for each registered application window independently.

    The main window is registered automatically. Secondary windows should be registered via registerWindow — typically by the service responsible for creating them.

    Uses two complementary signals per window for robust detection:

    • window focus/blur events (OS-level window focus changes)
    • document visibilitychange events (browser tab switches)

    Blur events are debounced per window with setTimeout(0) so that focus moving between elements within the same window does not produce a false blur: the subsequent focus event cancels the pending blur before it fires.

    Each per-window event is latched — it only fires when that window's focus state actually changes.

    Implements

    Index

    Constructors

    Properties

    onDidWindowChangeFocus: Event<WindowFocusEvent> = ...

    Fires when an individual window's focus state changes. The event payload identifies which window changed and whether it gained or lost focus.

    A window losing focus to another application window will fire separately for each window involved: one event with hasFocus: false for the window that lost focus, and one with hasFocus: true for the window that gained it.

    onDidWindowChangeFocusEmitter: Emitter<WindowFocusEvent> = ...
    toDispose: DisposableCollection = ...
    windowStates: Map<Window, WindowTrackingState> = ...

    Per-window tracking state.

    Accessors

    Methods

    • Schedule a deferred blur check for this specific window. If no focus event arrives on this same window before the timeout fires, we treat it as a real focus loss for that window.

      Parameters

      • win: Window
      • state: WindowTrackingState

      Returns void