-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
[StatusIndicator] Add method to get indicator icon screen rect. #89275
Conversation
I don't quite understand what this status indicator is, could you provide an example? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aah, roger that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs are just fine now, can't speak on implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good.
Is there another usecase, outside of a popup? I wonder if we could perhaps add just an |
Can't think of any on top of my head. If not for a popup it could be used for other visual flair (e.g. item inside the main program window moving towards the taskbar). Very niche! A popup sounds more common. |
The only info
Until full multi-window support is implemented, it's going to be completely useless for Wayland anyway. But I plan to implement |
Not necessarily, if there's an API for making "native" menus. That said, I don't know the current platform APIs for this kind of stuff (if there's any) and probably we're going to make some non-screen-based ones anyways. I'm only slightly concerned about the amount of duplicated/deprecated API surface we might have if we ever switch to (or just add) a window-centric API, which is what Wayland needs. We should really set up a meeting or something one day, as it's not a trivial matter IMO. |
Most apps (at least on macOS and Windows) aren't using menus as popup (2/3 of indicators I currently have on macOS are fully custom popups). Not sure if there's any kind of native menu.
Edit: Other UI toolkits seems to handle it in the same way, e.g, https://doc.qt.io/qt-6/qsystemtrayicon.html#geometry |
@bruvgz
Mh... Not sure about other platforms, but it looks like there's actually a native menu API for FreeDesktop in the indicator logic: This stuff is ancient though, I'm not sure how much it's actually implemented but sway has a todo comment for that, so there's still some modern interest. We could investigate on whether KDE and GNOME implement it.
Note that Qt has also a I would really like to avoid adding another screen-based API, but if it becomes too complicated we could let this one in too and offset the problem to when we'll have to manage the other ones anyways. |
So this got stale, can we reach a consensus? It seems to me like we don't know yet whether FreeDesktop allows more than just screen coordinates for this API, so I feel like it might be best to merge this for now, and if we figure out another API would be better in the future, we can implement that and deprecate this one? Or have both options, which seems to be what FreeDesktop may offer? |
I'm pretty sure FreeDesktop indeed offers the APIs discussed above, as QT (or at least, telegram-desktop) tries to use it (by looking at That said, the only usecase provided here is making menus, which has already been addressed in #89588. It offers a new generic interface which allows platforms to handle menus however they please, without exposing platform-specific stuff to scripting. In fact, by looking at the code it looks like the Windows backend is fetching the icon rect just fine through this new interface. In any case, if there's still further need for this specific API, I'm not against merging this, as my main concern (generic menu handling) has been resolved. |
The primary purpose of this PR is positioning and displaying custom non-menu popups (which is not fully supported by DBus, it only provides click coordinates, not icon rect). You might also want to display some sort of popup without user clicking the tray icon (which seems to be impossible with DBus, but can be done on macOS and Windows, and will require icon rect). |
@bruvzg you're right, DBus does not expose that information. That said, as there are still usecases for other platforms outside of menus, so I'm all for it :D |
Thanks! |
Add
status_indicator_get_rect
method to get indicator rectangle in the screen coordinates. Usefully of positioning popups (existing methods only include mouse click coordinates).