[Rd] Possible x11 window manager window aggregation under one icon?

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Tue Mar 23 13:44:08 CET 2021

On 23 March 2021 at 13:18, Ivan Krylov wrote:
| On Mon, 22 Mar 2021 16:57:48 -0500
| Dirk Eddelbuettel <edd using 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 using 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.

| 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.


https://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org

More information about the R-devel mailing list