toplevel-icon: set to app-id, instead of hardcoding to "foot"

And, special case "footclient", and map it to "foot".
This commit is contained in:
Daniel Eklöf 2024-09-08 18:25:07 +02:00
parent 0cb07027f2
commit b34137dde3
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 29 additions and 4 deletions

View file

@ -4944,10 +4944,31 @@ render_refresh_app_id(struct terminal *term)
};
timerfd_settime(term->render.app_id.timer_fd, 0, &timeout, NULL);
} else {
term->render.app_id.last_update = now;
xdg_toplevel_set_app_id(term->window->xdg_toplevel, term->app_id ? term->app_id : term->conf->app_id);
return;
}
const char *app_id =
term->app_id != NULL ? term->app_id : term->conf->app_id;
xdg_toplevel_set_app_id(term->window->xdg_toplevel, app_id);
#if defined(HAVE_XDG_TOPLEVEL_ICON)
if (term->wl->toplevel_icon_manager != NULL) {
struct xdg_toplevel_icon_v1 *icon =
xdg_toplevel_icon_manager_v1_create_icon(
term->wl->toplevel_icon_manager);
xdg_toplevel_icon_v1_set_name(
icon, streq(app_id, "footclient") ? "foot" : app_id);
xdg_toplevel_icon_manager_v1_set_icon(
term->wl->toplevel_icon_manager, term->window->xdg_toplevel, icon);
xdg_toplevel_icon_v1_destroy(icon);
}
#endif
term->render.app_id.last_update = now;
}
void

View file

@ -1813,9 +1813,13 @@ wayl_win_init(struct terminal *term, const char *token)
#if defined(HAVE_XDG_TOPLEVEL_ICON)
if (wayl->toplevel_icon_manager != NULL) {
const char *app_id =
term->app_id != NULL ? term->app_id : term->conf->app_id;
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_v1_set_name(icon, streq(
app_id, "footclient") ? "foot" : app_id);
xdg_toplevel_icon_manager_v1_set_icon(
wayl->toplevel_icon_manager, win->xdg_toplevel, icon);
xdg_toplevel_icon_v1_destroy(icon);