-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Easier identification of ImGui windows on X11 #8289
Comments
Hello, |
I might have a clue to how we can implement it. Might also make a PR if we decided we want to include this functionality into dear imgui. On X11 there is the This means that we should be setting the same app ID for both the origin and all workspace windows, in order for them to be grouped correctly. However, what I can't really wrap my head around is whether we need to actually give unique identifiers to these child windows, and if we have to, how do we do it? To be honest, from what I know the task of remembering the position of a window is performed by the Session manager/Window manager so maybe setting some type of unique ID might help the session manager remember the window positions from the previous session. I might be overthinking it though, so it's best I research this. As a side note, this is really useful for a lot of use-cases, specifically the way desktop environments manage taskbar icons. Though there is a way to set the application icon on X11/Wayland, many desktop environments ignore it in favour of using the icon from the application's desktop file. So an example application will first need to have a desktop entry like this: [Desktop Entry]
Type=Application
Version=1.0
Name=example
Icon=example-icon
TryExec=example
Exec=example
StartupWMClass=example with the Anyway, these strings are set by the backend. For example, here is an X11/Wayland compatible way to set your Window ID in glfw, which I use in one of my applications: #ifdef GLFW_PLATFORM_X11
glfwWindowHintString(GLFW_X11_CLASS_NAME, applicationName.c_str());
#endif
#ifdef GLFW_PLATFORM_WAYLAND
glfwWindowHintString(GLFW_WAYLAND_APP_ID, applicationName.c_str());
#endif So the easiest solution would be to create a string field for such an ID in the backends configuration for GLFW, SDL2 and SDL3. There are a couple of questions that still stand, however:
I will return with the required research on points 1 and 2 as soon as possible. |
Version/Branch of Dear ImGui:
Version 1.91.7 WIP, Branch: docking
Back-ends:
imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler, OS:
Linux i3wm (x11)
Full config/build information:
Details:
My Issue:
Managing ImGui windows under i3wm (or other tiling window managers) is problematic because all ImGui windows either lack sufficient unique identifiers or share a generic
WM_CLASS
property. This limitation makes it difficult to apply specific window management rules, such as automatically enabling floating mode for docked ImGui windows. For example, in i3wm’s configuration file, users would like to apply a rule like:for_window [class="ImGui"] floating enable
for_window [instance="ImGui"] floating enable
Proposed Solution:
ImGui could set a custom
WM_CLASS
property or another identifier for their windows on X11, allowing for easier and more precise window management in tiling window managers like i3wm.Screenshots/Video:
2025-01-03.23-20-38.mp4
xprop output of ImGui docked window:
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: