From kry|ov@r00t @end|ng |rom gm@||@com  Wed Apr 14 09:36:14 2021
From: kry|ov@r00t @end|ng |rom gm@||@com (Ivan Krylov)
Date: Wed, 14 Apr 2021 07:36:14 -0000
Subject: [Rd] 
 [Solved] Possible x11 window manager window aggregation under
 one icon?
In-Reply-To: <24669.59012.651091.193661@stat.math.ethz.ch>
References: <24662.10270.163829.883433@rob.eddelbuettel.com>
 <20210322223254.5434ff0d@Tarkus>
 <b225821d-3a86-49b9-51de-7dda280f0492@gmail.com>
 <20210323000121.66c76f27@Tarkus>
 <24665.4828.899674.534062@rob.eddelbuettel.com>
 <24665.24387.615121.367408@rob.eddelbuettel.com>
 <20210323131858.4776a571@Tarkus>
 <4db182f4-d282-ff22-d0ee-8bf79abf3035@gmail.com>
 <20210323185407.76115f1b@arachnoid>
 <a2e0f28c-b118-1a38-65a6-819d974ae9f2@gmail.com>
 <24666.10031.444487.469197@rob.eddelbuettel.com>
 <24667.1747.993142.397629@stat.math.ethz.ch>
 <24668.36274.53383.514330@rob.eddelbuettel.com>
 <ca146334-92de-2328-db73-2556f2649144@gmail.com>
 <24669.59012.651091.193661@stat.math.ethz.ch>
Message-ID: <20210326210646.70f3a21c-5966@Tarkus>


On Fri, 26 Mar 2021 14:49:56 +0100
Martin Maechler <maechler at stat.math.ethz.ch> wrote:

> I concluded I liked the first [patch] because it would achieve
> what's considered "uniformly better" in the sense that it makes
> R graphics behave like "all other" desktop applications *and* it
> would do so for all possible window manager scheme without any
> need of some desktop setting (which a typical user would not
> know about, nor know that s?he should/could change).

Martin, here is some information on how X11 (and rgl) windows are
grouped on different platforms, depending on the presence of the first
patch and the .desktop file:

 - GNOME [1] needs a .desktop file to group windows by their WM_CLASS
   and otherwise groups windows by their WM_HINTS.window_group only,
   which makes different configurations possible:
   * no window_group, no .desktop file: no grouping
   * window_group patch, no .desktop file: plot windows grouped
     per-process, x11 and rgl separately
   * StartupWMClass in .desktop file: x11 and rgl windows from all R
     processes grouped together
 - the XQuartz window manager apparently uses WM_HINTS.window_group but
   not WM_CLASS to group windows [2] (patch is only relevant for
   rgl, .desktop files aren't relevant)
 - Xfce groups windows by WM_CLASS [3], so adding WM_HINTS.window_group
   or changing the .desktop file doesn't group them any more
 - KDE seems to follow the .desktop file (if StartupWMClass is
   present) and group by WM_CLASS otherwise [4], but I don't have it
   installed to check. On the other hand, KDE might be ignoring
   WM_HINTS.window_group, judging by the absence of "WM2GroupLeader" in
   the source code of Plasma Workspace. This implies no changes in
   window grouping from patching window_group or changing the .desktop
   file. [5]

To summarise, the patch to x11() leads to visible window grouping in
GNOME-based environments. My impression is that most environments group
windows by WM_CLASS (which had been happening without the patch), but
there are far too many window managers to check that impression.

-- 
Best regards,
Ivan

[1] Including Cinammon:
https://github.com/linuxmint/cinnamon/blob/72732da43e971b83d926af56998c83ee8d000394/src/cinnamon-window-tracker.c#L482

Likely Unity forks too.

[2] Judging by
https://stat.ethz.ch/pipermail/r-devel/2021-March/080571.html

[3] With minor inconsistencies regarding x11 vs rgl windows between
Win+Tab "switch between application windows" and the window buttons on
the task bar, but let's not focus on that.

[4]
https://invent.kde.org/plasma/plasma-workspace/-/blob/7c49a0ae/libtaskmanager/xwindowtasksmodel.cpp#L439

[5] Strictly speaking, StartupWMClass= in the .desktop file lets the
desktop environment associate the plot windows with the R launcher
button if it's also present on the task bar.



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