mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
Add default-floating-position relative-to property
This commit is contained in:
@@ -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"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user