jaywilkas/xpytile

Add support for client-side-decoration in XFCE 4.18

Closed this issue · 10 comments

j-zero commented

Hi,

I'm running Arch with XFCE 4.18 on my old laptop and i really like xpytile! Thank you!
But, there is a problem with client side decorated windows (CSD) like GTK 3/4 (e.g. Firefox):
Bildschirmfoto_2023-05-09_23-09-08

As you can see, the window decoration is server side in tiling mode.

Any ideas how to fix this?

I must admit, currently I don't have a clue.
Let me try to figure this out.
As a work around you could turn off CSD for Firefox.

j-zero commented

I think this happens because of two things:

  1. You force the server-side decoration with window.change_property(MOTIF_WM_HINTS, MOTIF_WM_HINTS, 32, hints)in the set_decoration method, even if the window originally didn't have server-side decoration.
  2. The window has an invisible border (gtk3/4?) which causes the "inner" window not to fit in the tile.

I'm completely new to Python, GTK3, xlib and stuff. So that are wild guesses 🤷

I would say you are absolutely right!

To check this out, you can modify xpytile.py and add a return statement in set_window_decoration() as the first statement to let the function return immediately without doing anything. The extra border wont appear, but of course you can't toggle border on/off any more.
Unfortunately this is only one part of the problem. As you can see, the size of the CSD-window is not set correctly because of that 'invisible border'.

So there are two things to be figured out:

  • how to find out whether a window has CSD or SSD
  • how to cope with the invisible border of CSD windows in order to set their position and size correctly
j-zero commented

I think the first part would be "easy" to fix. My suggestion would be: Don't force the window decoration.
On toggling the borders, just look, if the windows has the MOTIF_WM_HINTS for decoration, if not, don't touch it. If it has: save the window id in an array. If the user toggles back, just reset the hints to the original state.
Same on window creation. Just make a backup and put it back on toggle.

The second part could be a GTK problem, not xlib.

The script now checks whether a windows uses client-side-decoration and if so doesn't toggle the borders.

j-zero commented

Damn, it works like charm. Thank you!

j-zero commented

Oh, next problem. What about Qt applications with CSD? They have the same problem.

Hi j-zero,

can you tell me which (preferably) small Qt application with CSD causes the same problem?

j-zero commented

For me it's the original Telegram client.

In the config-file you can now define which (Qt-)applications have client-side decoration and should not be (un)decorated by xpytile.