mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
wayland: set toplevel icon
If the xdg-toplevel-icon-v1 protocol is available, and we have the corresponding manager global, set the toplevel icon to "foot". Note: we do *not* provide any pixel data. This is by design; we want to keep things simple. To be able to provide pixel data, we would have to either: * embed the raw pixel data in the foot binary * link against either libpng or/and e.g. nanosvg, locate, at run-time, the paths to our own icons, and load them at run-time. * link against either libpng or/and e.g. nanosvg, and, at run-time, do a full icon lookup. This would also require us to add a config option for which icon theme to use. Of the two, I would prefer the first option. But, let's skip this completely for now. By providing the icon as a name, the compositor will have to lookup the icon itself. Compositors supporting icons is likely to already support this. So what do we gain by implementing this protocol? Compositors no longer has to parse .desktop files and map our app-id to find the icon to use. There's one question remaining. With this patch, the icon name is hardcoded to "foot", just like our .desktop files. But, perhaps we should use the app-id instead? And if so, should we also change the icon when the app-id changes? My gut feeling is, yes, we should use the app-id instead, and yes, we should update the icon when the app-id is changed at run-time.
This commit is contained in:
parent
28a1c67dd5
commit
0cb07027f2
1 changed files with 11 additions and 0 deletions
11
wayland.c
11
wayland.c
|
|
@ -1811,6 +1811,17 @@ wayl_win_init(struct terminal *term, const char *token)
|
|||
|
||||
xdg_toplevel_set_app_id(win->xdg_toplevel, conf->app_id);
|
||||
|
||||
#if defined(HAVE_XDG_TOPLEVEL_ICON)
|
||||
if (wayl->toplevel_icon_manager != NULL) {
|
||||
struct xdg_toplevel_icon_v1 *icon =
|
||||
xdg_toplevel_icon_manager_v1_create_icon(wayl->toplevel_icon_manager);
|
||||
xdg_toplevel_icon_v1_set_name(icon, "foot");
|
||||
xdg_toplevel_icon_manager_v1_set_icon(
|
||||
wayl->toplevel_icon_manager, win->xdg_toplevel, icon);
|
||||
xdg_toplevel_icon_v1_destroy(icon);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (conf->csd.preferred == CONF_CSD_PREFER_NONE) {
|
||||
/* User specifically do *not* want decorations */
|
||||
win->csd_mode = CSD_NO;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue