Skip to content

feat(glfw): set Wayland app_id / X11 WM_CLASS via Application::setAppId - #129

Open
youngzyl wants to merge 2 commits into
xfangfang:wiliwilifrom
youngzyl:feat/set-window-app-id
Open

youngzyl wants to merge 2 commits into
xfangfang:wiliwilifrom
youngzyl:feat/set-window-app-id

Conversation

@youngzyl

@youngzyl youngzyl commented Aug 2, 2026

Copy link
Copy Markdown

Problem

On Wayland, wiliwili's window reports an empty app_id (verified via KWin: resourceClass=""), so desktop environments like KDE Plasma cannot match the window to its .desktop entry. Result: the window shows no icon in the icon-only taskbar.

Root cause: the bundled GLFW only sends xdg_toplevel_set_app_id when the GLFW_WAYLAND_APP_ID hint is set (see xfangfang/glfw wl_window.c), and borealis never sets it.

Fix

Add a small Application::setAppId() API (call it before createWindow()) and apply it via:

  • GLFW_WAYLAND_APP_ID (Wayland app_id)
  • GLFW_X11_CLASS_NAME / GLFW_X11_INSTANCE_NAME (X11 WM_CLASS)

Only affects the GLFW desktop backend; no-op when the app id is empty. Other platforms are untouched.

Companion PR in wiliwili will call brls::Application::setAppId("cn.xfangfang.wiliwili"). Follow-up issue: xfangfang/wiliwili (taskbar icon).

Desktop environments (KDE Plasma, GNOME, ...) match windows to .desktop
entries using the Wayland app_id or the X11 WM_CLASS. Without a class
the taskbar cannot associate the window with a .desktop entry, so
icon-only taskbars show no icon.

Add Application::setAppId() (call before createWindow()) and apply it
through the GLFW_WAYLAND_APP_ID / GLFW_X11_CLASS_NAME /
GLFW_X11_INSTANCE_NAME hints when creating the GLFW window.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Borealis-level API to set an application identifier and forwards it into GLFW window hints so Linux desktop environments can correctly associate a window with its .desktop entry (Wayland app_id / X11 WM_CLASS), enabling proper taskbar icon matching.

Changes:

  • Introduces brls::Application::setAppId() / getAppId() to store an application identifier.
  • Applies the stored app ID to GLFW window hints during GLFW window creation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
library/lib/platforms/glfw/glfw_video.cpp Sets platform windowing hints based on Application::getAppId() before window creation.
library/include/borealis/core/application.hpp Adds setAppId/getAppId API and backing storage for the app identifier.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +241 to +250
#if defined(__linux__) || defined(_WIN32) || defined(__APPLE__)
// Set the application ID so desktop environments can match this window to its
// .desktop entry (Wayland app_id / X11 WM_CLASS) — required for taskbar icons.
const std::string& appId = Application::getAppId();
if (!appId.empty())
{
glfwWindowHint(GLFW_WAYLAND_APP_ID, appId.c_str());
glfwWindowHint(GLFW_X11_CLASS_NAME, appId.c_str());
glfwWindowHint(GLFW_X11_INSTANCE_NAME, appId.c_str());
}
Comment on lines 64 to +66
static inline uint32_t ORIGINAL_WINDOW_WIDTH = 1280;
static inline uint32_t ORIGINAL_WINDOW_HEIGHT = 720;
inline static std::string appId = "";
The Wayland/X11 app id hints are string hints and must be passed via
glfwWindowHintString() (glfwWindowHint() takes an int). Also close the
#if block and guard each hint macro for GLFW < 3.3 compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants