Difference Between Dwindle, Master, and Monocle Layouts in Hyprland
Hyprland provides three distinct tiled layout algorithms—Dwindle, Master, and Monocle—that differ fundamentally in window arrangement logic, with Dwindle using recursive binary splits, Master utilizing a dedicated master area with a slave stack, and Monocle displaying only one fullscreen window at a time.
The hyprwm/Hyprland compositor implements these layouts as separate classes under the src/layout/algorithm/tiled/ directory, each conforming to the common ITiledAlgorithm interface. Understanding the difference between Dwindle, Master, and Monocle layouts in Hyprland allows you to optimize workspace organization for coding, browsing, or media consumption workflows.
How the Layout Algorithms Work
Each layout algorithm manages a list of window targets and calculates their geometries when the workspace state changes. The WorkspaceAlgoMatcher factory instantiates the appropriate class based on your configuration:
makeUnique<Tiled::CDwindleAlgorithm>()for DwindlemakeUnique<Tiled::CMasterAlgorithm>()for MastermakeUnique<Tiled::CMonocleAlgorithm>()for Monocle
All three implement virtual methods such as newTarget(), removeTarget(), and recalculate() to handle window lifecycle events, but they diverge significantly in their spatial logic.
Dwindle Layout
The Dwindle layout creates a binary tree of splits that alternate between horizontal and vertical orientations. When you open a new window, the algorithm divides the currently focused window’s region, toggling the split direction each time to produce a "dwindling" effect.
- No master-slave hierarchy: Unlike Master, Dwindle treats every node as an equal split of its parent. While the internal
SDwindleNodeDatastructure may track a master flag for internal bookkeeping, any window can occupy any position in the tree. - Recursive subdivision: The algorithm walks the node tree in [
DwindleAlgorithm.cpp](https://github.com/hyprwm/Hyprland/blob/main/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp) to calculate geometries, ensuring space-efficient packing regardless of window count.
Master Layout
The Master layout introduces an explicit master area that holds one or more privileged windows, while remaining windows populate a stack area. This mirrors classic tiling window manager behavior seen in dwm or i3’s stacked mode.
- Master node tracking: The algorithm maintains a designated master via
getMasterNode()and stores metadata inSMasterNodeData, including theisMasterboolean andpercMaster(the percentage of screen real estate allocated to the master region). - Dynamic resizing: When windows are added, removed, or moved, [
MasterAlgorithm.cpp](https://github.com/hyprwm/Hyprland/blob/main/src/layout/algorithm/tiled/master/MasterAlgorithm.cpp) adjustspercMasterand recalculates stack geometries based on the configuredmaster_orientation(left, right, top, or bottom).
Monocle Layout
The Monocle layout maximizes the focused window to fill the entire workspace while keeping other windows hidden in a stack. Switching focus cycles through the stack without resizing or repositioning windows.
- Single visible target: The algorithm tracks the currently visible window via
getVisibleTarget()and updates this pointer when you invokecycleNext()orcyclePrev()in [MonocleAlgorithm.cpp](https://github.com/hyprwm/Hyprland/blob/main/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp). - No split calculations: Because windows are never displayed simultaneously, Monocle skips complex geometry calculations and simply sets the active window’s dimensions to match the workspace bounds.
Configuration Examples
You declare the layout for a workspace in your hyprland.conf. The WorkspaceAlgoMatcher parses these strings during workspace initialization.
Setting Dwindle for Automatic Tiling
workspace = 1, layout:dwindle
This instantiates a CDwindleAlgorithm object that recursively splits windows as they are created.
Configuring Master with Left-Side Master Area
workspace = 2, layout:master
master_orientation = left
master_size = 0.55
The CMasterAlgorithm assigns 55% of the width to the master area (controlled by percMaster) and places the stack on the right.
Enabling Monocle for Fullscreen Workflows
workspace = 3, layout:monocle
With CMonocleAlgorithm active, only one window renders at a time. Use key bindings to cycle:
bind = $mainMod, J, cyclenext
bind = $mainMod, K, cycleprev
These trigger cycleNext() and cyclePrev() to update the visible target.
Programmatic Layout Switching
Plugins or internal modules can switch layouts dynamically through the layout manager:
#include <Hyprland.hpp>
// Switch workspace 1 to Master algorithm
g_pLayoutManager->setLayoutForWorkspace(1, "master");
This call routes through WorkspaceAlgoMatcher to construct the appropriate algorithm instance.
Summary
- Dwindle recursively alternates horizontal and vertical splits without a master-slave distinction, defined in [
DwindleAlgorithm.hpp](https://github.com/hyprwm/Hyprland/blob/main/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.hpp). - Master maintains a dedicated master area using
SMasterNodeDatawithisMasterflags andpercMastersizing, implemented in [MasterAlgorithm.cpp](https://github.com/hyprwm/Hyprland/blob/main/src/layout/algorithm/tiled/master/MasterAlgorithm.cpp). - Monocle displays a single fullscreen window via
getVisibleTarget()and cycles focus withcycleNext(), located in [MonocleAlgorithm.cpp](https://github.com/hyprwm/Hyprland/blob/main/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp). - The
WorkspaceAlgoMatchermaps configuration strings to these concrete implementations usingmakeUniquefactory methods.
Frequently Asked Questions
How do I switch between Dwindle and Master layouts at runtime?
You can change the layout for the current workspace using the setlayout dispatcher or by calling g_pLayoutManager->setLayoutForWorkspace() with the string identifier "dwindle", "master", or "monocle". Hyprland immediately destroys the old algorithm instance and constructs the new one, preserving the window list but recalculating all geometries according to the new rules.
Can I have multiple master windows in the Master layout?
Yes. While the default configuration uses a single master window, the CMasterAlgorithm supports multiple masters by adjusting the master count parameter. The SMasterNodeData structure tracks which windows have isMaster set to true, and the algorithm divides the master area evenly among them before allocating space to the stack.
Why does Monocle layout hide my windows instead of closing them?
Monocle implements a "stack" metaphor where all windows remain mapped but only the active one receives visibility. The algorithm sets the inactive windows' geometries outside the visible workspace bounds or masks them, allowing instant switching via cycleNext() without the overhead of unmapping and remapping buffers. This preserves window state while providing a fullscreen-like experience.
Which layout consumes the least CPU resources?
Monocle typically incurs the lowest computational cost because it skips recursive split calculations and master percentage adjustments. It simply assigns the workspace bounds to one window. Dwindle and Master require tree traversals or master node calculations on every window addition or removal, though the difference is negligible on modern hardware unless managing hundreds of windows.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →