Adding variable tiling width ratio and gaps to XFCE xfwm4
394 words, 2 minutes
After a lot of desktop environment and window manager hoping, I’ve settle down with XFCE. I find it customizable, pretty and fast. But after all my hoping, I’ve always missed a couple of things learned from the tiling window manager world: resizable master area and gaps.
Here a couple of patches I wrote to enable those two features for Xfwm4.
For a long time, I’ve used xdotools to tile the windows width ratio and insert gaps. The script was called using keystrokes. But I couldn’t find a way to use the “snap” feature of XFCE. Patching the sources provides the usage of mouse to manage the windows.
Because XFCE is available as version 4.16 on OpenBSD 7.2-STABLE, I started patching that particular Xfwm4 version. In OpenBSD 7.2-CURRENT, XFCE 4.18 was made available. Patches for both version are available here.
The 4.18 patches have been submitted to the XFCE project . Hopefully, they will make their way to the upstream code.
Here what the applied patches look like from the user perspective.
Patches for Xfwm4 4.16 can be downloaded here .
Patches for Xfwm4 4.18 can be downloaded here .
As I built them on OpenBSD, patches are expected to be installed in
/usr/ports/x11/xfce4/xfwm4/patches
. But they can probably be applied
straight away from Xfwm4 source directory if you’re using another OS.
Those patches will expose 3 new variables in the xfce4-settings-editor
application. In the xfwm4
section, you’ll find tile_ratio
, gaps_inner
and
gaps_outer
.
tile_ratio
sets the percentage of screen width that the left tiled window(s) will use. The default value of 50 sets the width to 50% of the screen width ; that’s what Xfwm4 does by default. I set it to 60 so that windows are tiled using a 60/40 ratio. If it is set to 30, the left window(s) will be tiled using a third of the screen width ; the right window(s) will be tiled using two thirds of the screen width.gaps_outer
sets the gap space between desktop edges and window(s). I set it to 10 to have a 10px gap. The horizontal and vertical gaps have the same width and height.gaps_inner
sets the gap space between windows. I set it to 5 to have a global gap of 10px between windows. The horizontal and vertical gaps have the same height and width.
Hope it helps. See you on r/unixporn :D