From ddf70467d40ad11e27f04a3ff8dfe2ae828514c3 Mon Sep 17 00:00:00 2001 From: Matt Guerrette Date: Thu, 30 Apr 2020 11:29:50 -0400 Subject: [PATCH] Update WM_CLASS property on Linux using xcb This commit updates the WM_CLASS property to display a better title than "Unknown" for each example in the dash and application menu. Update WM_CLASS property on Linux using xcb This commit updates the WM_CLASS property to display a better title than "Unknown" for each example in the dash and application menu. --- base/vulkanexamplebase.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index 66695059..429292b4 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -1783,6 +1783,18 @@ xcb_window_t VulkanExampleBase::setupWindow() free(reply); + /** + * Set the WM_CLASS property to display + * title in dash tooltip and application menu + * on GNOME and other desktop environments + */ + std::string wm_class; + wm_class = wm_class.insert(0, name); + wm_class = wm_class.insert(name.size(), 1, '\0'); + wm_class = wm_class.insert(name.size() + 1, title); + wm_class = wm_class.insert(wm_class.size(), 1, '\0'); + xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window, XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 8, wm_class.size() + 2, wm_class.c_str()); + if (settings.fullscreen) { xcb_intern_atom_reply_t *atom_wm_state = intern_atom_helper(connection, false, "_NET_WM_STATE");