mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2026-09-20 06:12:54 +00:00
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
This commit is contained in:
+34
-55
@@ -1,6 +1,6 @@
|
||||
### Description
|
||||
|
||||
# btrtile — A Focus-Driven Tiling Layout
|
||||
# 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.
|
||||
|
||||
@@ -14,39 +14,35 @@ While dwl’s patches folder is full of different layouts, I couldn't find suita
|
||||
|
||||
---
|
||||
|
||||
# Features
|
||||
|
||||
- **Combined Tiling and Management**
|
||||
Combines tiling layout and management of clients under one patchset.
|
||||
|
||||
- **Focus-Driven Splits**
|
||||
When you add a new client, btrtile checks where your pointer is relative to the focused client’s geometry.
|
||||
- If the pointer is on the left half (for a horizontally large client), the new client spawns on the left side, and vice versa.
|
||||
- By default, new splits are 50/50.
|
||||
|
||||
- **Adaptive Splitting**
|
||||
- If the area to be split is wider than its height, btrtile does a vertical split.
|
||||
- Otherwise, it does a horizontal split.
|
||||
|
||||
- **Keyboard and Mouse Driven**
|
||||
- Supports keyboard-based commands for quick ratio adjustments and client swapping.
|
||||
- Mouse-based resizing and moving are integrated for more intuitive manipulation.
|
||||
|
||||
---
|
||||
|
||||
# How It Works
|
||||
|
||||
btrtile organizes clients using a binary tree data structure that represents splits either vertically or horizontally.
|
||||
|
||||
When a new client appears:
|
||||
1. **Focused Client Detection**
|
||||
btrtile checks your pointer location to find which client (if any) you’re interacting with.
|
||||
2. **Split Creation**
|
||||
- If there’s a focused client, btrtile creates a split node around it, placing the new client on the side where your pointer is.
|
||||
|
||||
3. **Ratio Management**
|
||||
Each split node has a `split_ratio` (defaulting to 0.5). This ratio defines how much space is allocated to each child node. You can adjust this ratio using keyboard or mouse actions.
|
||||
# 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:**
|
||||
```c
|
||||
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 Doesn’t Handle
|
||||
@@ -56,23 +52,6 @@ When a new client appears:
|
||||
|
||||
---
|
||||
|
||||
# Configuring btrtile
|
||||
|
||||
btrtile adds couple variables to config.h to fine tune the mouse resizing of tiled clients.
|
||||
|
||||
1. **resize_factor**
|
||||
- A multiplier to transfer pointer movement to client weight ratio. Depends heavily on mouse sensitivity.
|
||||
Defaults to 0.0002f.
|
||||
|
||||
2. **resize_interval_ms**
|
||||
- A time based resize call limiter. Depends on framerate and screen refresh rate.
|
||||
Defaults to 16ms. (~60 resize updates per second)
|
||||
|
||||
Fine tune these values to find the best values for your setup, smoother resizing can significally increase cpu overhead.
|
||||
If mouse resizing feels sluggish, you can try compiling dwl with more aggressive optimization flags like -O2/-O3.
|
||||
|
||||
---
|
||||
|
||||
# Patch recommendations
|
||||
|
||||
1. **Patches that I use with my btrtile**
|
||||
@@ -95,11 +74,11 @@ If mouse resizing feels sluggish, you can try compiling dwl with more aggressive
|
||||
---
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/julmajustus/dwl/src/branch/btrtile-dev)
|
||||
- [0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/btrtile/btrtile-v0.8.patch)
|
||||
- [0.8 WITH gaps](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/btrtile/btrtile-v0.8-gaps.patch)
|
||||
- [wlroots-next](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/btrtile/btrtile-wlroots-next-d41ecb7.patch)
|
||||
- [wlroots-next WITH gaps](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/btrtile/btrtile-wlroots-next-d41ecb7-gaps.patch)
|
||||
- [git branch](https://codeberg.org/julmajustus/dwl/src/branch/btrtile-0.9)
|
||||
- [0.8](./btrtile-v0.8.patch)
|
||||
- [0.8 WITH gaps](./btrtile-v0.8-gaps.patch)
|
||||
- [main-d16036e](./btrtile-d16036e.patch)
|
||||
- [main-d16036e WITH gaps](./btrtile-gaps-d16036e.patch)
|
||||
|
||||
### Authors
|
||||
- [julmajustus](https://codeberg.org/julmajustus)
|
||||
|
||||
Reference in New Issue
Block a user