Subject: Re: bug#62164: 29.0.60; ediff behaves poorly by default on tiling window managers

From: [email-masked]
Date: Sun, 02 Apr 2023 01:53:26 +0000 (UTC)

Po Lu <[email-masked]> writes:
> Spencer Baugh <[email-masked]> writes:
>> On Mon, Mar 13, 2023 at 8:59 PM Po Lu <[email-masked]> wrote:
>>> BTW, `x-change-window-property' lets you mess around with window
>>> properties if you want.  No frame parameter needed.
>>
>> AFAICT, my tiling window manager (XMonad) makes its tiling vs floating
>> decision when the window is first created, so changing the window
>> property after the fact doesn't help.  I assume most tiling window
>> managers behave the same.
>
> You can withdraw the window prior to mapping it: see
> `make-frame-visible' and `make-frame-invisible'.
>
> Window managers don't care about a window until it is mapped.

Thank you for this.  With that I was able to put together this simple
patch which makes the ediff control window float by default on tiling
window managers, or at least on most of them.

What do you think about this patch?  It would be really nice to have
this behavior by default in this way, and I think it would benefit many
users.

diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el
index eb903f093f9..1a09bc4225e 100644
--- a/lisp/vc/ediff-wind.el
+++ b/lisp/vc/ediff-wind.el
@@ -948,6 +948,19 @@ ediff-setup-control-frame
     (goto-char (point-min))
 
     (modify-frame-parameters ctl-frame adjusted-parameters)
+    (if (eq window-system 'x)
+      (x-change-window-property
+       "_NET_WM_WINDOW_TYPE"
+       '("_NET_WM_WINDOW_TYPE_UTILITY")
+       ctl-frame
+       "ATOM" 32
+       t)
+      (x-change-window-property
+       "WM_TRANSIENT_FOR"
+       (list (string-to-number (frame-parameter nil 'window-id)))
+       ctl-frame
+       "WINDOW" 32
+       t))
     (make-frame-visible ctl-frame)
 
     ;; This works around a bug in 19.25 and earlier.  There, if frame gets
--