toga icon indicating copy to clipboard operation
toga copied to clipboard

Provide means for app to indicate that an application requires attention

Open johnzhou721 opened this issue 5 months ago • 2 comments

What is the problem or limitation you are having?

A way for application to request user attention, such as flashing the taskbar icon or bouncing or shaking it.

Describe the solution you'd like

On Windows some apps does something like flashing the red icon in the taskbar. That is Form.Activate.

On macOS it's the icon bouncing. This is https://developer.apple.com/documentation/appkit/nsapplication/requestuserattention(_:)?language=objc

On GTK+ it's like an icon shaking... like when you do open <file> in a terminal but there's a huge bunch of windows on top... a cursory search suggests gtk_window_set_urgency_hint?

Qt: QApplication::alert.

Describe alternatives you've considered

Do nothing

Additional context

No response

johnzhou721 avatar Aug 14 '25 22:08 johnzhou721

Sure - this sounds like a reasonable feature to add, and one that can be a safe no-op on platforms where the feature doesn't make sense (or hasn't been implemented). To that end, it should probably be documented as "will make a best effort to alert the user, but may not do anything".

As for what the API should be called - app.request_attention() (or maybe just app.attention()) makes sense to me, but I'm open to other suggestions.

freakboy3742 avatar Aug 14 '25 23:08 freakboy3742

Sure - this sounds like a reasonable feature to add, and one that can be a safe no-op on platforms where the feature doesn't make sense (or hasn't been implemented). To that end, it should probably be documented as "will make a best effort to alert the user, but may not do anything".

Agreed. Might be more specific in documentation by saying no mobile platforms have this functionality.

[sidenote: I'm not touching BeeWare besides filing some issues like this in a few months since my courses are much more rigorous than I expected]

EDIT (submitted early, accidentally held cmd)

As for what the API should be called - app.request_attention() (or maybe just app.attention()) makes sense to me, but I'm open to other suggestions.

Sure. Both are fine from my viewpoint, and I don't have any more suggestions or any views on the name. What's in a name[1], anyways?

[1] since we've already have a bunch of allusions to Rome and also like Brutus or the ides of march...

EDIT 2 (just realized I had more signal[2] to add) we should probably use NSCriticalRequest as the type, as all other platforms have the flash / rotate continuously since it is triggered. Might be worth documenting

[2] pun sorta intended, since I'm working on Qt stuff

johnzhou721 avatar Aug 14 '25 23:08 johnzhou721

FYI -- this is unimplementable on GTK4, since we only support Wayland and GTK loves not supporting all available Wayland things: https://github.com/dino/dino/issues/1379

On mobile platforms, there really isn't an equivalent.

johnzhou721 avatar Nov 24 '25 22:11 johnzhou721