Skip to main content

Overview

In the layout {} section you can change various settings that influence how windows are positioned and sized.
layout {
    gaps 16
    center-focused-column "never"
    always-center-single-column
    
    preset-column-widths {
        proportion 0.33333
        proportion 0.5
        proportion 0.66667
    }
    
    default-column-width { proportion 0.5; }
}
You can override these settings for specific outputs and named workspaces.

Basic Layout

Gaps

Set gaps around (inside and outside) windows in logical pixels.
layout {
    gaps 16
}
You can use fractional values. The value will be rounded to physical pixels according to the scale factor of every output. For example, gaps 0.5 on an output with scale 2 will result in one physical-pixel wide gaps. You can emulate “inner” vs. “outer” gaps with negative struts values.

Center Focused Column

When to center a column when changing focus.
center-focused-column
string
default:"never"
  • never: no special centering, focusing an off-screen column will scroll it to the left or right edge
  • always: the focused column will always be centered
  • on-overflow: focusing a column will center it if it doesn’t fit on screen together with the previously focused column
layout {
    center-focused-column "always"
}

Always Center Single Column

If set, niri will always center a single column on a workspace, regardless of the center-focused-column option.
layout {
    always-center-single-column
}

Empty Workspace Above First

If set, niri will always add an empty workspace at the very start, in addition to the empty workspace at the very end.
layout {
    empty-workspace-above-first
}

Default Column Display

Sets the default display mode for new columns. Can be normal or tabbed.
// Make all new columns tabbed by default.
layout {
    default-column-display "tabbed"

    tab-indicator {
        hide-when-single-tab
    }
}

Column and Window Sizing

Preset Column Widths

Set the widths that the switch-preset-column-width action (Mod+R) toggles between.
proportion
number
Sets the width as a fraction of the output width, taking gaps into account. For example, you can perfectly fit four windows sized proportion 0.25 on an output.
fixed
number
Sets the window width in logical pixels exactly.
layout {
    // Cycle between 1/3, 1/2, 2/3 of the output, and a fixed 1280 logical pixels.
    preset-column-widths {
        proportion 0.33333
        proportion 0.5
        proportion 0.66667
        fixed 1280
    }
}

Default Column Width

Set the default width of new windows. The syntax is the same as in preset-column-widths.
layout {
    // Open new windows sized 1/3 of the output.
    default-column-width { proportion 0.33333; }
}
You can also leave the brackets empty, then the windows themselves will decide their initial width:
layout {
    // New windows decide their initial width themselves.
    default-column-width {}
}
default-column-width {} causes niri to send a (0, H) size in the initial configure request. This is a bit unclearly defined in the Wayland protocol, so some clients may misinterpret it.default-column-width {} is most useful for specific windows, in form of a window rule with the same syntax.

Preset Window Heights

Set the heights that the switch-preset-window-height action (Mod+Shift+R) toggles between.
layout {
    // Cycle between 1/3, 1/2, 2/3 of the output, and a fixed 720 logical pixels.
    preset-window-heights {
        proportion 0.33333
        proportion 0.5
        proportion 0.66667
        fixed 720
    }
}

Visual Effects

Focus Ring and Border

Focus ring and border are drawn around windows and indicate the active window. They are very similar and have the same options.

Focus Ring

Drawn only around the active window

Border

Drawn around all windows and affects their sizes (windows shrink to make space)
layout {
    focus-ring {
        width 4
        active-color "#7fc8ff"
        inactive-color "#505050"
        urgent-color "#9b0000"
    }
    
    border {
        off
        width 4
        active-color "#ffc87f"
        inactive-color "#505050"
    }
}
Set the thickness of the border in logical pixels. You can use fractional values. For example, width 0.5 on an output with scale 2 will result in one physical-pixel thick borders.
layout {
    border {
        width 2
    }
}
Colors can be set in a variety of ways:
  • CSS named colors: "red"
  • RGB hex: "#rgb", "#rgba", "#rrggbb", "#rrggbbaa"
  • CSS-like notation: "rgb(255, 127, 0)", "rgba()", "hsl()" and a few others
layout {
    focus-ring {
        active-color "#7fc8ff"
        inactive-color "#505050"
        urgent-color "#9b0000"
    }
}
Similarly to colors, you can set active-gradient and inactive-gradient, which will take precedence.Gradients are rendered the same as CSS linear-gradient(angle, from, to). The angle works the same as in linear-gradient, and is optional, defaulting to 180.
layout {
    focus-ring {
        active-gradient from="#80c8ff" to="#bbddff" angle=45
    }
}
Gradients can be colored relative to windows individually (the default), or to the whole view of the workspace:
layout {
    border {
        active-gradient from="#ffbb66" to="#ffc880" angle=45 relative-to="workspace-view"
        inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"
    }
}
You can set the gradient interpolation color space:
layout {
    border {
        active-gradient from="#f00f" to="#0f05" angle=45 in="oklch longer hue"
    }
}
Supported color spaces: srgb (default), srgb-linear, oklab, oklch with hue interpolation options.
By default, focus ring and border are rendered as a solid background rectangle behind windows. That is, they will show up through semitransparent windows.If you don’t like that, you should uncomment the prefer-no-csd setting at the top level of the config.

Shadow

Shadow rendered behind a window.
layout {
    shadow {
        on
        softness 30
        spread 5
        offset x=0 y=5
        color "#00000070"
    }
}
softness
number
default:"30"
Controls the shadow softness/size in logical pixels, same as CSS box-shadow blur radius. Setting softness 0 will give you hard shadows.
spread
number
default:"5"
Distance to expand the window rectangle in logical pixels, same as CSS box-shadow spread. Spread can be negative.
offset
x/y coordinates
Moves the shadow relative to the window in logical pixels. For example, offset x=2 y=2 will move the shadow 2 logical pixels downwards and to the right.
draw-behind-window
boolean
default:"false"
Set to true to make shadows draw behind the window rather than just around it. This fixes shadow artifacts inside CSD rounded corners.
color
color
The shadow color and opacity.
inactive-color
color
Override the shadow color for inactive windows. By default, a more transparent color is used.

Tab Indicator

Controls the appearance of the tab indicator that appears next to columns in tabbed display mode.
layout {
    tab-indicator {
        on
        hide-when-single-tab
        place-within-column
        gap 5
        width 4
        length total-proportion=1.0
        position "right"
        gaps-between-tabs 2
        corner-radius 8
        active-color "red"
        inactive-color "gray"
    }
}
hide-when-single-tab
flag
Hide the indicator for tabbed columns that only have a single window
place-within-column
flag
Put the tab indicator “within” the column, rather than outside. This will include it in column sizing and avoid overlaying adjacent columns.
gap
number
default:"5"
Gap between the tab indicator and the window in logical pixels. Can be negative to put the indicator on top of the window.
width
number
default:"4"
Thickness of the indicator in logical pixels
length
total-proportion
Controls the length of the indicator. Set the total-proportion property to make tabs take up this much length relative to the window size.
position
string
default:"right"
Position of the tab indicator relative to the window: left, right, top, or bottom

Insert Hint

Settings for the window insert position hint during an interactive window move.
layout {
    insert-hint {
        color "#ffc87f80"
        gradient from="#ffbb6680" to="#ffc88080" angle=45 relative-to="workspace-view"
    }
}
off
flag
Disables the insert hint altogether

Struts

Struts shrink the area occupied by windows, similarly to layer-shell panels. You can think of them as a kind of outer gaps. They are set in logical pixels.
layout {
    struts {
        left 64
        right 64
        top 64
        bottom 64
    }
}
Left and right struts will cause the next window to the side to always peek out slightly. Top and bottom struts will simply add outer gaps in addition to the area occupied by layer-shell panels and regular gaps.
You can use fractional values. You can use negative values. They will push the windows outwards, even outside the edges of the screen.
You can use negative struts with matching gaps value to emulate “inner” vs. “outer” gaps. For example, use this for inner gaps without outer gaps:
layout {
    gaps 16

    struts {
        left -16
        right -16
        top -16
        bottom -16
    }
}

Background Color

Set the default background color that niri draws for workspaces. This is visible when you’re not using any background tools like swaybg.
layout {
    background-color "#003300"
}
You can also set the color per-output in the output config.

Build docs developers (and LLMs) love