From 0d8287c1228c188f772fd1874c6af8ecd27c71bd Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Sun, 18 Oct 2026 01:51:20 +0200 Subject: [PATCH] feat(wayland): Window::SetAppId xdg_toplevel.set_app_id, so the compositor can match the window to its .desktop file: the icon, the task switcher, activation. --- implementations/Crafter.Graphics-Window.cpp | 6 ++++++ interfaces/Crafter.Graphics-Window.cppm | 3 +++ 2 files changed, 9 insertions(+) diff --git a/implementations/Crafter.Graphics-Window.cpp b/implementations/Crafter.Graphics-Window.cpp index 5bd2045..0e3fdf5 100644 --- a/implementations/Crafter.Graphics-Window.cpp +++ b/implementations/Crafter.Graphics-Window.cpp @@ -620,6 +620,12 @@ void Window::SetTitle(const std::string_view title) { #endif } +void Window::SetAppId(const std::string_view id) { + #ifdef CRAFTER_GRAPHICS_WINDOW_WAYLAND + xdg_toplevel_set_app_id(xdgToplevel, std::string(id).c_str()); + #endif +} + void Window::SetTextInput(bool active, std::int32_t x, std::int32_t y, std::int32_t width, std::int32_t height, TextInputPurpose purpose) { #ifdef CRAFTER_GRAPHICS_WINDOW_WAYLAND textInputActive_ = active; diff --git a/interfaces/Crafter.Graphics-Window.cppm b/interfaces/Crafter.Graphics-Window.cppm index 7fd4276..b4e4176 100644 --- a/interfaces/Crafter.Graphics-Window.cppm +++ b/interfaces/Crafter.Graphics-Window.cppm @@ -157,6 +157,9 @@ export namespace Crafter { void StartUpdate(); void StopUpdate(); void SetTitle(const std::string_view title); + // The xdg app id, which the compositor matches to a .desktop file + // for the icon, the task switcher and activation. + void SetAppId(const std::string_view id); // Tells the compositor's input method that a text field has focus // (an on-screen keyboard opens) and where its caret is, in physical // pixels, or that none has. Remembered: it is applied again whenever