Make it possible to tell if a tab currently has focus #17689
Labels
Area-VT
Virtual Terminal sequence support
Issue-Feature
Complex enough to require an in depth planning process and actual budgeted, scheduled work.
Needs-Author-Feedback
The original author of the issue/PR needs to come back and respond to something
No-Recent-Activity
This issue/PR is going stale and may be auto-closed without further activity.
Product-Terminal
The new Windows Terminal.
Description of the new feature/enhancement
It would be useful for a program running in a terminal to be able to tell whether it currently has focus. My use case for this is after a command finishes, I sometimes want my shell to ring the bell, which makes me notice the terminal, but this is annoying if I currently have the window focused.
The FocusIn/FocusOut reporting alone isn't enough, as that needs a focus change to happen and it's not always possible to have reporting on when running an arbitrary program.
Proposed technical implementation details (optional)
There is some discussion on https://unix.stackexchange.com/questions/480052/how-do-i-detect-whether-my-terminal-has-focus-in-the-gui-from-a-shell-script
Apparently GNOME based terminals (VTE) send an event immediately when FocusIn/FocusOut reporting is turned on. In some ways this would be the easiest way to implement this, as other terminals do already do it, so programs have to handle this. If other terminals weren't doing it, I would be against it, but given they are programs have to deal with it anyway.
Alternatively maybe
wt.exe
could allow querying for whether a$WT_SESSION
currently has focus (although the details of that seem harder, some X11 terminals have a$WINDOWID
which directly corresponds to the X11 window ID, I don't know how to go from the guid session ID to anything useful).The text was updated successfully, but these errors were encountered: