Dirk Eddelbuettel
2021-Mar-23 12:44 UTC
[Rd] Possible x11 window manager window aggregation under one icon?
On 23 March 2021 at 13:18, Ivan Krylov wrote: | On Mon, 22 Mar 2021 16:57:48 -0500 | Dirk Eddelbuettel <edd at debian.org> wrote: | | > Do you want to send a proper patch to bugzilla? | | Would be glad to, especially if we manage to solve that problem you | uncovered while I was asleep. | | On Mon, 22 Mar 2021 22:23:47 -0500 | Dirk Eddelbuettel <edd at debian.org> wrote: | | > Close, close, close but no cigar yet: For a given R process, x11() | > windows group for a that process. But we often run multiple R | > processes. Have you seen anything for grouping under the | > "program" (in some sense) but not the concrete process from it? | | Do windows from different Emacs processes group together the way you | want them to group? What other applications group together for you | despite running from different processes? Do they have the same window | id # of group leader in `xprop WM_HINTS`? I checked Firefox, but its | windows all seem to have the same _NET_WM_PID. "All of them, but R". Right now (under unity) I have four for Gnome Terminal (clearly distinct processes), two for Chrome (plus more temporarily), and two for emacs (two windows from same process, I checked that launching a new one clearly aggregates within). But R is different, and I see this as a bug. How "grave" it is is open for debate, but the application behaves differently under the window manager. The overall behaviour is consistent, yet R sticks out. I think it shouldn't. | I decided to copy the way GVim sets its group leader ID (because I know | the windows are different processes _and_ that they group in Xfce) and | spent a while chasing this red herring before realising that (1) on my | PC, different x11() windows are still grouped together, even from | different R processes, even without the patch (I never used the "group | windows" option in xfce4-panel before) and (2) different GVim windows | actually have different group leader XIDs in their WM_HINTS properties. | Oops. Hah! | Apparently Xfce uses libwnck [*] which groups windows by WM_CLASS in | addition to WM_HINTS (as far as understand the code). | | Here is what GNOME Shell does [**] besides looking at | WM_HINTS.window_group: | | - looks up the window's WM_CLASS in .desktop files known to it | - looks up the window's _NET_WM_PID among running applications (?) | - looks for an XDG startup notification matching the window | - checks other things not likely applicable to R, such as sandbox IDs | and GApplication IDs | | Adding StartupWMClass=R_x11 to R.desktop (not part of R sources, but | part of the .deb package, I believe) should help GNOME Shell match all | x11() windows to a single application without any changes to devX11.c, | but I don't have GNOME installed to check it. Easy enough for me to check, but I won't get to it for a bit. | Alternatively, we can also add a _NET_WM_PID property to x11() windows | (in the hope that GNOME Shell matches the PIDs to the same binary), but | then we'd have to add the WM_CLIENT_MACHINE property too [***], which | is way more hacky than I would prefer it to be: [proposed change set omitted] Ok. You did amazing. I had poked around a little in one or two apps but not made any progress. Dirk -- https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Dirk Eddelbuettel
2021-Mar-23 13:15 UTC
[Rd] Possible x11 window manager window aggregation under one icon?
On 23 March 2021 at 07:44, Dirk Eddelbuettel wrote: | On 23 March 2021 at 13:18, Ivan Krylov wrote: | | Apparently Xfce uses libwnck [*] which groups windows by WM_CLASS in | | addition to WM_HINTS (as far as understand the code). | | | | Here is what GNOME Shell does [**] besides looking at | | WM_HINTS.window_group: | | | | - looks up the window's WM_CLASS in .desktop files known to it | | - looks up the window's _NET_WM_PID among running applications (?) | | - looks for an XDG startup notification matching the window | | - checks other things not likely applicable to R, such as sandbox IDs | | and GApplication IDs | | | | Adding StartupWMClass=R_x11 to R.desktop (not part of R sources, but | | part of the .deb package, I believe) should help GNOME Shell match all | | x11() windows to a single application without any changes to devX11.c, | | but I don't have GNOME installed to check it. | | Easy enough for me to check, but I won't get to it for a bit. Ok, I tried. And amazingly that worked (with a small "but")! Added the line to the (installed) /usr/share/applications/R.desktop, asked Gnome Shell to restart (Alt-F2, then r [where r standards for restart, not littler ;-) ]) and the (existing) two windows (from two distinct 'live' and long-running plot/monitor sessions) are now regrouped in the 'dock', which would for the first time be correct behaviour under Gnome (as I understand it). Only one small downside: the regrouped icon switches to the old R icon (which is probably the one we bitmapped). Would you know how we could force the new one? Dirk -- https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org