edison23

Zápisky šíleného jazykového editora

Window tiling on Xubuntu

I love Xubuntu because it's fast, stable, customizable, and lightweight. However, after I acquired a wide 12:5 display, I found it hard to use Xubuntu because its window manager doesn't support the kind of windows tiling you have on MS Windows with FancyZones that enable you to make efficient use of your very wide screen. And so, I wrote Xutiles, a windows tiling helper for X.

Datum: 2024-11-20
Kategorie: EN Software Linux Unix
Štítky: linux ext4 xubuntu xfce

Obsah


Why we need windows tiling

I acquired a wide 12:5 display with 3880×1600 px resolution to avoid the need for two or three physical displays on my desk.

Physical multi-monitor setup

With one wide screen, I could avoid this immensely cool but fairly impractical setup. The wide screen is awesome but to make full use of it, I need the ability to tile windows on the screen to emulate the two or three physical displays. For example, like this:

Example of windows tiling on a wide screen

However, out of the box, Xubuntu (its window manager xfwm4, to be precise) can only do halves and quarters. That's not enough for me, I need one main window and two or three secondary ones. Similar to what I had with my multi-monitor setup - one QHD 16:9 screen and one or two old HD 5:4 screens. When I did a LaTeX scientific book typesetting job, I had each of the three screen split into halves or even quarters to fit all the windows I needed to see. That was a brutal edge case, indeed, but the case stands nonetheless.

Whatever grudges I may have against MS Windows, their Fancy Zones fulfill this requirement greatly. Similarly, Kubuntu has KZones addon and Gnome has, among other, gTile. I searched for something like that usable on Xubuntu but failed to find anything comfortably functional. And I refused to switch to a tiling window manager because I enjoy the fancy DE (desktop environment) stuff a XFCE, Plasma, or Gnome give me. The one tiling manager I tried didn't give me anything remotely similar to the full graphical DE experience I get with "normal" DEs. It's great the tiling WMs exist but they're simply not for me.

And with this, I switched to Kubuntu. For a while, I enjoyed the customization options, well worked-out tiling addon, and prettiness of Plasma, Kubuntu DE. But soon grew more and more frustrated by its instability. It's like Vivaldi - you get awesome good looking browser that you can customize to the last pixel. But it's unstable as hell.

Meet Xutiles

After a year of using Kubuntu, I looked for options to get back to Xubuntu harder. When I found none, I decided to make one.

Thanks to the awesome wide range of window manipulation utilities on *buntu Linux, I was able to write a fairly simple BASH script which I call Xutiles (as in Xubuntu Tiles, but pronounced as a Greek hero - /ksutɪlɛs/).

The script is available on GitHub - GitHub - edison23/xutiles: Window tiling for X.

Refer to the README there for usage guide.

Use Xutiles

Xutiles is tailored to my use case, and that's the need to place a window to a predefined area (zone) on the screen using a keyboard shortcut. KZones and FancyZones support Super (the Windows key) + arrows. I don't care much for moving windows between adjacent zones so I didn't bother figuring out a logic for that. Xutiles simply takes one argument that's bound to one zone and places the current active window to the particular zone.

For this to work efficiently, you need to bind a set of keyboard shortcuts to the predefined set of zones. With this setup, if you have three zones, you could have, for instance:

  • Super+KP 4 bound to invoke ~/scripts/xutiles.sh 0 which places the active window to the left full-height zone.
  • Super+KP 9 bound to invoke ~/scripts/xutiles.sh 1 which places the active window to the top-right zone.
  • Super+KP 3 bound to invoke ~/scripts/xutiles.sh 2 which places the active window to the bottom-right zone.

This shortcut binding is particularly useful if you have numeric block on your keyboard, because the shortcut key positions correspond to the zone placement on the screen:

Zones layout example with corresponding numeric keyboard keys for shortcuts

After you do basic setup in Xutiles (set your screen resolution and adjust windows decoration details), you can comfortably tile your windows on Xubuntu using keyboard shortcuts.