feat: fixed(?) binds and window-rules modules
This commit is contained in:
parent
e540b21ed9
commit
e7320119cd
2 changed files with 104 additions and 103 deletions
|
|
@ -1,55 +1,8 @@
|
||||||
{
|
{ self, inputs, ... }:
|
||||||
self,
|
|
||||||
inputs,
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
|
|
||||||
widthDivisions = [
|
|
||||||
1.0
|
|
||||||
2.0
|
|
||||||
3.0
|
|
||||||
4.0
|
|
||||||
];
|
|
||||||
heightDivisions = [
|
|
||||||
1.0
|
|
||||||
2.0
|
|
||||||
3.0
|
|
||||||
4.0
|
|
||||||
];
|
|
||||||
|
|
||||||
# black magic, expected output:
|
|
||||||
# [ { proportion = 1.0 / 1.0 }
|
|
||||||
# { proportion = 1.0 / 2.0 }
|
|
||||||
# ...
|
|
||||||
# { proportion = 2.0 / 1.0 }
|
|
||||||
# { proportion = 2.0 / 3.0 }
|
|
||||||
# ...
|
|
||||||
# { proportion = 4.0 / 4.0 } ]
|
|
||||||
getProportions =
|
|
||||||
divisions:
|
|
||||||
lib.lists.unique (
|
|
||||||
lib.lists.flatten (
|
|
||||||
# TODO: make this a callable function
|
|
||||||
map (x: map (y: { proportion = x / y; }) divisions) divisions
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
# then get all the unique outputs (removing double ups of 0.5 or others)
|
|
||||||
# just getting all the values below 1
|
|
||||||
columnWidths = getProportions widthDivisions;
|
|
||||||
columnWidthsFiltered = builtins.filter (x: builtins.lessThan x.proportion 1.0) columnWidths;
|
|
||||||
windowHeights = getProportions heightDivisions;
|
|
||||||
windowHeightsFiltered = builtins.filter (x: builtins.lessThan x.proportion 1.0) windowHeights;
|
|
||||||
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
# niri keybinds module declaration
|
||||||
flake.nixosModules.niri-binds =
|
flake.nixosModules.niri-binds =
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
|
@ -57,6 +10,48 @@ in
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
widthDivisions = [
|
||||||
|
1.0
|
||||||
|
2.0
|
||||||
|
3.0
|
||||||
|
4.0
|
||||||
|
];
|
||||||
|
heightDivisions = [
|
||||||
|
1.0
|
||||||
|
2.0
|
||||||
|
3.0
|
||||||
|
4.0
|
||||||
|
];
|
||||||
|
|
||||||
|
# black magic, expected output:
|
||||||
|
# [ { proportion = 1.0 / 1.0 }
|
||||||
|
# { proportion = 1.0 / 2.0 }
|
||||||
|
# ...
|
||||||
|
# { proportion = 2.0 / 1.0 }
|
||||||
|
# { proportion = 2.0 / 3.0 }
|
||||||
|
# ...
|
||||||
|
# { proportion = 4.0 / 4.0 } ]
|
||||||
|
getProportions =
|
||||||
|
divisions:
|
||||||
|
lib.lists.unique (
|
||||||
|
lib.lists.flatten (
|
||||||
|
# TODO: make this a callable function
|
||||||
|
map (x: map (y: { proportion = x / y; }) divisions) divisions
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
# then get all the unique outputs (removing double ups of 0.5 or others)
|
||||||
|
# just getting all the values below 1
|
||||||
|
columnWidths = getProportions widthDivisions;
|
||||||
|
columnWidthsFiltered = builtins.filter (x: builtins.lessThan x.proportion 1.0) columnWidths;
|
||||||
|
windowHeights = getProportions heightDivisions;
|
||||||
|
windowHeightsFiltered = builtins.filter (x: builtins.lessThan x.proportion 1.0) windowHeights;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
# for home manager functionality
|
# for home manager functionality
|
||||||
|
|
|
||||||
|
|
@ -1,70 +1,77 @@
|
||||||
{ self, inputs, ... }:
|
{ self, inputs, ... }:
|
||||||
|
|
||||||
let
|
{
|
||||||
|
|
||||||
windowRules = [
|
# niri window rules module declaration
|
||||||
{
|
flake.nixosModules.niri-window-rules =
|
||||||
geometry-corner-radius =
|
{ pkgs, ... }:
|
||||||
let
|
|
||||||
radius = 16.0;
|
let
|
||||||
in
|
|
||||||
|
windowRules = [
|
||||||
{
|
{
|
||||||
bottom-left = radius;
|
geometry-corner-radius =
|
||||||
bottom-right = radius;
|
let
|
||||||
top-left = radius;
|
radius = 16.0;
|
||||||
top-right = radius;
|
in
|
||||||
};
|
{
|
||||||
clip-to-geometry = true;
|
bottom-left = radius;
|
||||||
draw-border-with-background = false;
|
bottom-right = radius;
|
||||||
}
|
top-left = radius;
|
||||||
{
|
top-right = radius;
|
||||||
matches = [ { app-id = "kitty"; } ];
|
};
|
||||||
opacity = 0.95;
|
clip-to-geometry = true;
|
||||||
}
|
draw-border-with-background = false;
|
||||||
{
|
}
|
||||||
matches = [ { is-floating = true; } ];
|
|
||||||
default-floating-position = {
|
|
||||||
relative-to = "top-left";
|
|
||||||
x = 1720;
|
|
||||||
y = 720;
|
|
||||||
};
|
|
||||||
max-height = 720;
|
|
||||||
max-width = 1720;
|
|
||||||
opacity = 0.95;
|
|
||||||
shadow.enable = true;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
matches = [
|
|
||||||
{
|
{
|
||||||
at-startup = true;
|
matches = [ { app-id = "kitty"; } ];
|
||||||
title = "btop";
|
opacity = 0.95;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
matches = [ { is-floating = true; } ];
|
||||||
|
default-floating-position = {
|
||||||
|
relative-to = "top-left";
|
||||||
|
x = 1720;
|
||||||
|
y = 720;
|
||||||
|
};
|
||||||
|
max-height = 720;
|
||||||
|
max-width = 1720;
|
||||||
|
opacity = 0.95;
|
||||||
|
shadow.enable = true;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
matches = [
|
||||||
|
{
|
||||||
|
at-startup = true;
|
||||||
|
title = "btop";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
open-on-output = "DP-4";
|
||||||
|
open-on-workspace = "System";
|
||||||
|
open-maximized = true;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
matches = [ { title = "calculator"; } ];
|
||||||
|
open-floating = true;
|
||||||
|
open-focused = true;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
open-on-output = "DP-4";
|
|
||||||
open-on-workspace = "System";
|
in
|
||||||
open-maximized = true;
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
matches = [ { title = "calculator"; } ];
|
|
||||||
open-floating = true;
|
|
||||||
open-focused = true;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
in
|
# for home manager functionality
|
||||||
|
imports = [ inputs.home-manager.nixosModules.home-manager ];
|
||||||
|
|
||||||
{
|
# using the home manager module to assign binds
|
||||||
flake.nixosModules.niri-window-rules = { pkgs, ... }: {
|
home-manager.users.serenity.programs.niri.settings = {
|
||||||
|
# grabs assigned rules from let bindings above
|
||||||
# for home manager functionality
|
|
||||||
imports = [ inputs.home-manager.nixosModules.home-manager ];
|
|
||||||
|
|
||||||
home-manager.users.serenity = {
|
|
||||||
programs.niri.settings = {
|
|
||||||
window-rules = windowRules;
|
window-rules = windowRules;
|
||||||
layout = {
|
layout = {
|
||||||
background-color = "transparent";
|
background-color = "transparent";
|
||||||
};
|
};
|
||||||
|
# pushes wallpaper set by noctalia to the lowest layer
|
||||||
layer-rules = [
|
layer-rules = [
|
||||||
{
|
{
|
||||||
matches = [ { namespace = "^noctalia-wallpaper*"; } ];
|
matches = [ { namespace = "^noctalia-wallpaper*"; } ];
|
||||||
|
|
@ -73,5 +80,4 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue