From 793e92e9d69f3640754d9ece40ddc7723cf49292 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Mon, 30 Dec 2024 13:22:02 +0300 Subject: Add default-floating-position relative-to property --- wiki/Configuration:-Window-Rules.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'wiki/Configuration:-Window-Rules.md') diff --git a/wiki/Configuration:-Window-Rules.md b/wiki/Configuration:-Window-Rules.md index 6fd5e2a8..131dfac8 100644 --- a/wiki/Configuration:-Window-Rules.md +++ b/wiki/Configuration:-Window-Rules.md @@ -52,7 +52,7 @@ window-rule { block-out-from "screencast" // block-out-from "screen-capture" variable-refresh-rate true - default-floating-position x=100 y=200 + default-floating-position x=100 y=200 relative-to="bottom-left" focus-ring { // off @@ -523,15 +523,22 @@ Afterward, the window will remember its last floating position. By default, new floating windows open at the center of the screen, and windows from the tiling layout open close to their visual screen position. The position uses logical coordinates relative to the working area. +By default, they are relative to the top-left corner of the working area, but you can change this by setting `relative-to` to one of these values: `top-left`, `top-right`, `bottom-left`, `bottom-right`. + For example, if you have a bar at the top, then `x=0 y=0` will put the top-left corner of the window directly below the bar. +If instead you write `x=0 y=0 relative-to="top-right"`, then the top-right corner of the window will align with the top-right corner of the workspace, also directly below the bar. + +The coordinates change direction based on `relative-to`. +For example, by default (top-left), `x=100 y=200` will put the window 100 pixels to the right and 200 pixels down from the top-left corner. +If you use `x=100 y=200 relative-to="bottom-left"`, it will put the window 100 pixels to the right and 200 pixels *up* from the bottom-left corner. ```kdl -// Open the Firefox picture-in-picture window at the top-left corner of the screen +// Open the Firefox picture-in-picture window at the bottom-left corner of the screen // with a small gap. window-rule { match app-id="firefox$" title="^Picture-in-Picture$" - default-floating-position x=32 y=32 + default-floating-position x=32 y=32 relative-to="bottom-left" } ``` -- cgit