1
1
Fork 0

niri: add pip window rules

Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
Myned 2025-01-01 12:45:00 -06:00
parent ec4a4c2f24
commit 16feb5f40f
Signed by: Myned
GPG key ID: C7224454F7881A34

View file

@ -61,17 +61,42 @@ in {
# https://github.com/YaLTeR/niri/wiki/Configuration:-Overview # https://github.com/YaLTeR/niri/wiki/Configuration:-Overview
# HACK: Prepend validated kdl config not currently implemented in settings module for e.g. custom build # HACK: Prepend validated kdl config not currently implemented in settings module for e.g. custom build
# https://github.com/sodiboo/niri-flake/blob/main/settings.nix # https://github.com/sodiboo/niri-flake/blob/main/settings.nix
config = with inputs.niri-flake.lib; config = let
(internal.settings-module {config = hm;}).options.programs.niri.config.default # BUG: Fixed width may not take borders into account
# https://github.com/sodiboo/niri-flake/blob/main/default-config.kdl.nix # https://github.com/YaLTeR/niri/issues/269
++ (with kdl; [ pip = with config.custom; rec {
# TODO: Migrate to window-rules when released x = gap;
# https://github.com/YaLTeR/niri/pull/871 y = gap;
(plain "window-rule" [ w = builtins.floor (h * 16 / 9); # 16:9
(leaf "match" {title = "^Picture.in.[Pp]icture$";}) h = builtins.floor (height / 3.0 - gap * 2 - border); # 33%
(leaf "open-floating" true) };
]) in
]); with inputs.niri-flake.lib;
(internal.settings-module {config = hm;}).options.programs.niri.config.default
# https://github.com/sodiboo/niri-flake/blob/main/default-config.kdl.nix
++ (with kdl; [
# TODO: Migrate to window-rules when released
# https://github.com/YaLTeR/niri/pull/871
(plain "window-rule" [
(leaf "match" {is-floating = true;})
(plain "border" [(flag "off")])
])
(plain "window-rule" [
(leaf "match" {title = "^Picture.in.[Pp]icture$";})
(leaf "default-floating-position" {
x = pip.x;
y = pip.y;
relative-to = "top-right";
})
(plain "default-column-width" [(leaf "fixed" (pip.w))])
(plain "default-window-height" [(leaf "fixed" (pip.h))])
(leaf "open-floating" true)
(leaf "open-focused" false)
])
]);
# https://github.com/YaLTeR/niri/wiki/Configuration:-Debug-Options # https://github.com/YaLTeR/niri/wiki/Configuration:-Debug-Options
# https://github.com/sodiboo/niri-flake/blob/main/docs.md#programsnirisettingsdebug # https://github.com/sodiboo/niri-flake/blob/main/docs.md#programsnirisettingsdebug