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.
This commit is contained in:
Matt Guerrette 2020-04-30 11:29:50 -04:00
parent 10a1ecaf7b
commit ddf70467d4

View file

@ -1783,6 +1783,18 @@ xcb_window_t VulkanExampleBase::setupWindow()
free(reply); 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) if (settings.fullscreen)
{ {
xcb_intern_atom_reply_t *atom_wm_state = intern_atom_helper(connection, false, "_NET_WM_STATE"); xcb_intern_atom_reply_t *atom_wm_state = intern_atom_helper(connection, false, "_NET_WM_STATE");