-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable AppFocus
and AppBlur
in terminal emulators
#4265
Commits on Mar 6, 2024
-
Add support for XTerm FocusIn/FocusOut detection
This enables support for receiving and handling FocusIn and FocusOut sequences, and turns then into AppFocus and AppBlur events.
Configuration menu - View commit details
-
Copy full SHA for 775d1b4 - Browse repository at this point
Copy the full SHA 775d1b4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2f13d7f - Browse repository at this point
Copy the full SHA 2f13d7fView commit details
Commits on Mar 7, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 67b4d45 - Browse repository at this point
Copy the full SHA 67b4d45View commit details -
Configuration menu - View commit details
-
Copy full SHA for b96bc9a - Browse repository at this point
Copy the full SHA b96bc9aView commit details -
Configuration menu - View commit details
-
Copy full SHA for d28596a - Browse repository at this point
Copy the full SHA d28596aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 497dc54 - Browse repository at this point
Copy the full SHA 497dc54View commit details -
Configuration menu - View commit details
-
Copy full SHA for 68ac360 - Browse repository at this point
Copy the full SHA 68ac360View commit details -
Only restore widget focus if the widget belongs to the current screen
While the terminal window didn't have focus, anything can could happen. The widget could be removed, the screen could change, etc. So by the time AppFocus happens the widget might not be one to focus any more. Initially I was just making it the focused widget anyway and letting the focus-handling code do what it needed to do. Sending focus to a widget that isn't part of the DOM any more isn't exactly a breaking problem; but... One issue is that you can end up with App.focused saying that a widget is focused that isn't in the DOM any more. We don't want that. So here I'm a bit more defensive. This changes things so that we check that the widget's screen is still the screen that's in play. If the widget has been removed it won't have a parent and so can't find its screen. All of this means that if the screen has changed *or* if the widget has been removed, we're covered.
Configuration menu - View commit details
-
Copy full SHA for faea8fa - Browse repository at this point
Copy the full SHA faea8faView commit details -
Add tests for AppFocus and AppBlur
These tests don't test the actual act of blurring or focusing the application (that's kind of hard to do in tests, really). What it does do is test that widget focus does the right thing after each of those app-level events.
Configuration menu - View commit details
-
Copy full SHA for 8c18c9e - Browse repository at this point
Copy the full SHA 8c18c9eView commit details -
Configuration menu - View commit details
-
Copy full SHA for f148e1f - Browse repository at this point
Copy the full SHA f148e1fView commit details -
Update the docstrings of AppFocus and AppBlur
Remove the text so say they're only for textual-web, but make it clear textual-web is supported, as are any other terminals that support the required sequences.
Configuration menu - View commit details
-
Copy full SHA for 11fbf4f - Browse repository at this point
Copy the full SHA 11fbf4fView commit details -
Co-authored-by: TomJGooding <101601846+TomJGooding@users.noreply.github.com> Co-authored-by: Will McGugan <willmcgugan@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for a687be9 - Browse repository at this point
Copy the full SHA a687be9View commit details -
Don't restore focus on AppFocus if something has focus
While the application is in an AppBlur state, it's possible that some code could have been running that updated what's focused. It doesn't make sense to have Textual itself override the dev's choice to have focus be somewhere else (perhaps the result of some long-running background process, that they've tabbed away from, and when they tab back they expect to be in a specific control). So here I tweak the code that restores the focused widget so that it only restores if it's still the case that nothing has focus.
Configuration menu - View commit details
-
Copy full SHA for 4bb9b59 - Browse repository at this point
Copy the full SHA 4bb9b59View commit details
Commits on Mar 11, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 02e9109 - Browse repository at this point
Copy the full SHA 02e9109View commit details -
Configuration menu - View commit details
-
Copy full SHA for c768beb - Browse repository at this point
Copy the full SHA c768bebView commit details