[GH-ISSUE #766] Feature: Ability to detect when TUI's terminal window is out of focus #978

Open
opened 2026-03-14 09:11:26 +03:00 by kerem · 0 comments
Owner

Originally created by @IdrisGit on GitHub (Mar 2, 2026).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/766

Something similar to web's document.visibilityState to detect when the terminal pane/window comes or goes out of focus, this could be helpful to run some side effects for which we need to know if user is actively looking at the TUI or not, for example, to send OS native notifications if user is out of focus or refetch some data when user comes back to the TUI.

Potential solution: maybe it can be detected using the FocusIn/FocusOut events emitted by most modern terminals

Originally created by @IdrisGit on GitHub (Mar 2, 2026). Original GitHub issue: https://github.com/anomalyco/opentui/issues/766 Something similar to web's `document.visibilityState` to detect when the terminal pane/window comes or goes out of focus, this could be helpful to run some side effects for which we need to know if user is actively looking at the TUI or not, for example, to send OS native notifications if user is out of focus or refetch some data when user comes back to the TUI. Potential solution: maybe it can be detected using the FocusIn/FocusOut events emitted by most modern terminals
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#978
No description provided.