1
1
Fork 0

niri: update rules to nix syntax

Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
Myned 2025-01-12 13:17:53 -06:00
parent 163cb674bb
commit d8427e213a
Signed by: Myned
GPG key ID: C7224454F7881A34
2 changed files with 35 additions and 44 deletions

View file

@ -61,48 +61,10 @@ in {
# https://github.com/YaLTeR/niri/wiki/Configuration:-Overview
# 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
config = let
# BUG: Fixed width may not take borders into account
# https://github.com/YaLTeR/niri/issues/269
pip = with config.custom; rec {
x = gap;
y = gap;
w = builtins.floor (width * 0.3 - gap); # 30%
h = builtins.floor (w * 9 / 16); # 16:9
};
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 "focus-ring" [(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)
])
(plain "window-rule" [
(leaf "match" {app-id = "^(sdl-|wl|x)freerdp$";})
(leaf "open-floating" false)
])
]);
config = 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; []);
# https://github.com/YaLTeR/niri/wiki/Configuration:-Debug-Options
# https://github.com/sodiboo/niri-flake/blob/main/docs.md#programsnirisettingsdebug

View file

@ -42,6 +42,14 @@ in {
clip-to-geometry = true;
}
{
# Floating
matches = [{is-floating = true;}];
border.enable = false;
focus-ring.enable = false;
}
{
# Startup
#?? <= 60 secs after niri launches
@ -139,10 +147,30 @@ in {
#// open-on-workspace = "2";
}
{
(let
# BUG: Fixed width may not take borders into account
# https://github.com/YaLTeR/niri/issues/269
pip = with config.custom; rec {
x = gap;
y = gap;
w = builtins.floor (width * 0.3 - gap); # 30%
h = builtins.floor (w * 9 / 16); # 16:9
};
in {
# PiP
matches = [{title = "^Picture.in.[Pp]icture$";}];
}
default-floating-position = {
x = pip.x;
y = pip.y;
relative-to = "top-right";
};
default-column-width.fixed = pip.w;
default-window-height.fixed = pip.h;
open-floating = true;
open-focused = false;
})
{
# Terminals
@ -170,6 +198,7 @@ in {
{app-id = "^virt-manager$";}
];
open-floating = false;
#// open-on-workspace = "1";
}