-
Couldn't load subscription status.
- Fork 186
xdg-toplevel-icon-v1 support #2755
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
Conversation
f96b101 to
7333ef3
Compare
|
Updated my branch to isolate |
|
Thanks for grabbing this one 😄 I've not yet done any higher level thinking on this one, nor read through it all in detail so the below is just some initial low-level review comments:
|
7333ef3 to
9e4fb59
Compare
OK, let's rename other signal handlers in #2765 first.
Agreed. I wrote that way because it was shorter, but it was indeed strange. Updated as suggested.
No, it asserts when |
9e4fb59 to
ff3a4b6
Compare
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.
Looked at bit into the diff, some comments below
9159c19 to
22d1f4e
Compare
|
I'm marking this PR as ready for final review since I've addressed the buffer sharing bug by adding |
22d1f4e to
d23d670
Compare
|
@tokyo4j thank you for this PR, I think the description should be updated since the buffer sharing bug is addressed by you |
|
Notwithstanding the review comments by @Consolatis above, I think this feels okay. Not tested. I ponder whether we ought to provide an override to force the .desktop file icon, but could follow up with that if users want it. Am I right in thinking that the specified icon-theme will be used when looking up the icons specified by |
I'm reluctant to merge this PR without @Consolatis's LGTM... can we wait for another week or so? I don't want to invade our codebase with codes that only I can follow (I admit
That's right. I think icon themes or buffers explicitly offered by clients should be usually prioritized for better out-of-box experience of applications like wine and gamescope. But I understand that your concern that this PR deprives users of the ability to set arbitrary icons with |
Appreciate that. I was intending to give a final review yesterday but RL stuff happened, will do tonight or tomorrow at the latest. |
|
Hello. Thank you for this PR! Tested with RetroArch (which is recently added support for this protocol) and it works great! |
|
I've read through the diff again and tried to test it nested. Other than the minor nitpick with the I don't really have any client which sets a icon using the protocol, foot only seems to set the icon name which is always a copy of the app-id foot is using so I can't really test it properly. But based on the code and feedback above that part seems to work well. Something we might want to consider as follow up PR is how to prioritize the different icon options. E.g. "that application X icon looks bad, I want the one from my icon theme" vs "this application spawns different windows and each has its own window icon but its always using the one from the theme for all the windows". My personal preference would be to provide a window rule attribute with some kind of enum to influence the priority selection. That approach could be used to express a global preference or app specific ones. Great work! |
RetroArch uses both icon name and icon buffer |
This patch also changes the semantics of scaled_icon_buffer: rather than calling scaled_icon_buffer_set_app_id() every time an app_id is set, we can now call scaled_icon_buffer_set_view() just once so that multiple scaled_icon_buffers bound to a window are automatically updated when an app_id is set or new icon is set via xdg-toplevel-icon-v1.
d23d670 to
e8d20e0
Compare
|
With all the threads resolved, I'll merge this PR.
That sounds sensible, but I'm not sure how the new window rule attribute should look like. If the goal is to allow users to set arbitrary icons, passing xdg-spec-reliant icon names (which also allows absolute paths) like |
I thought more about something like |
|
Wait, this PR turns the window icons to the fallback one after Reconfigure. I'll investigate and fix it soon. EDIT: fixed by #2794 |

This PR allows clients to set icons of titlebar, OSD and client-list-combined-menu, via xdg-toplevel-icon-v1.
This PR also changes the semantics of
scaled_icon_buffer: rather than callingscaled_icon_buffer_set_app_id()every time an app_id is set, we can now callscaled_icon_buffer_set_view()just once so that multiplescaled_icon_buffers bound to a window are automatically updated when an app_id is set or new icon is set via xdg-toplevel-icon-v1.buffer sharing problem (worked around)
But this approach has a major problem: the buffer may not be redrawn on app_id or icon updates, due to buffer sharing mechanism of
scaled_scene_buffer. Here's the reproducer of this problem:footwindowfootwindow and creates two instances ofscaled_icon_buffers that are considered "equal" according to_equal()inscaled-icon-buffer.c.senpaiin thefootwindow, which updates its app_idsenpai's one2025-05-25.00-12-03.mp4
A possible solution for this is storing
app_idandwlr_xdg_toplevel_icon_v1instance inscaled_icon_bufferand compare them in_equal(), but I'm not a fan of adding fields just for the sake of comparison.While it may sound too radical, but I'm actually thinking of removing the buffer sharing mechanism altogether. As an alternative optimization, we can implement caches of
lab_imgso that SVG images are not parsed for every icons. Of course this means we will consume more memory for buffers inscaled_scene_buffers, but I guess its memory overhead is negligible (< 100KB) in most cases. This also significantly reduces the complexity ofscaled_scene_bufferand prevents complicated bugs like #2485 and the one addressed by #2520. @Consolatis what do you think?