Files
dwl-patches/patches/btrtile
julmajustus 0d41b75737 btrtile: update and minor changes
- Updated to current main
 - Added more user toggles to control the behaviour of btrtile into
   config.h
 - Simplified the btrtile gapps logic
 - Simplified the changes to dwl.c
 - Added two keybind functions to swap and toggle splits
 - Minor code cleanups
 - Added functionality to respect the client size hints
2026-09-20 03:18:11 +03:00
..
2026-09-20 03:18:11 +03:00

Description

btrtile - A Focus-Driven Tiling Layout

It provides a focus-driven, mouse- and keyboard-friendly tiling layout that grants you granular control over how clients are placed and resized.

btrtile in action


Why btrtile

While dwls patches folder is full of different layouts, I couldn't find suitable layout that would work well with my workflow and single ultrawide monitor setup. btrtile aims to solve that by introducing a layout strategy that splits clients according to user focus and pointer position.


How it works

Clients live in a binary tree, every split has a ratio (50/50 by default).

When a new client opens, it splits the client you last focused. The pointer decides which side it lands on: left half of the client puts it on the left, and so on. If the area is wider than it is tall the split is vertical, otherwise horizontal. When several clients open at once, each one splits the previous one, so you get a nice spiral instead of a pile in one corner.

  • Mouse Drag a tiled client with MODKEY + left button to float it, drop it on another tiled client to place it next to it. MODKEY + right button resizes the divider next to the client you grabbed, it follows the pointer 1:1.
  • Keyboard setratio_h / setratio_v move a divider, swapclients swaps a client with its neighbour in a direction, togglesplit flips the direction of the split you're in (and keeps it that way), swapsplit mirrors the split.

config.h:

use_active_for_splits    = 1;    /* 1: split the last focused client, 0: the one under the pointer */
force_split              = 0;    /* 0: new client on the pointer's side, 1: always left/top, 2: always right/bottom */
preserve_split           = 0;    /* 1: splits keep their direction, 0: direction follows the shape of the area */
split_width_multiplier   = 1.0f; /* split side by side when width >= height * this */
resize_interval_ms       = 16;   /* limits mouse resize updates, 16ms is ~60 per second */

force_split = 2 gives you a predictable spiral if you don't want the pointer to matter. split_width_multiplier is handy on wide monitors, where windows tend to stay wider than tall for a long time.

Smoother mouse resizing costs some cpu, so tune resize_interval_ms to your refresh rate. If resizing feels sluggish, try compiling dwl with -O2/-O3.


What It Doesnt Handle

  • Suckless philosophy
    • Yea, it's a bloat. I tried to hide the suck inside a single file as much I could. While this approach is not ideal, it's how it's at least for now.

Patch recommendations

  1. Patches that I use with my btrtile

    • focusdir
      Great patch to move focus between clients.

    • rotatetags
      Good patch to rotate the view or shift clients between tags.

    • warpcursor
      Moves cursor location to focused client.

    • pertag
      Allows each tag to have individual layout setups.

    • gaps
      Add gaps between clients.


Download

Authors