Add API to give an App focus #3032
Labels
enhancement
New features, or improvements to existing features.
good first issue
Is this your first time contributing? This could be a good place to start!
What is the problem or limitation you are having?
When an app is currently active, it's possible to change which widget accepts input (i.e., has focus). However, it isn't possible to programmatically give an app focus if it isn't currently active.
Describe the solution you'd like
A new method
App.focus()
that ensures (to the extent possible) that the app is the currently active app.Describe alternatives you've considered
Don't add the API. It's impolite for apps to change focus.
Additional context
This will be a no-op on mobile and console platforms; it will likely be ignored on GTK.
On macOS, it can be implemented with:
App._impl.native.activateIgnoringOtherApps(True)
It will also be near impossible to verify in the testbed, because we can't programmatically give a different app focus. We can call the method... but only on the app that already, by definition, has focus.
Any documentation should highlight that it's really bad form for an app to bring itself into focus, so the method should be used sparingly.
The text was updated successfully, but these errors were encountered: