feat: fixed(?) binds and window-rules modules

This commit is contained in:
serenity-F 2026-09-22 00:36:29 +10:00
parent c23715f2f1
commit e540b21ed9
No known key found for this signature in database
2 changed files with 148 additions and 118 deletions

View file

@ -1,4 +1,6 @@
{ {
self,
inputs,
config, config,
pkgs, pkgs,
lib, lib,
@ -6,6 +8,7 @@
}: }:
let let
widthDivisions = [ widthDivisions = [
1.0 1.0
2.0 2.0
@ -37,20 +40,34 @@ let
); );
# then get all the unique outputs (removing double ups of 0.5 or others) # then get all the unique outputs (removing double ups of 0.5 or others)
# just getting all the values below 1
columnWidths = getProportions widthDivisions; columnWidths = getProportions widthDivisions;
columnWidthsFiltered = builtins.filter (x: builtins.lessThan x.proportion 1.0) columnWidths; # just get the values that are below 1 columnWidthsFiltered = builtins.filter (x: builtins.lessThan x.proportion 1.0) columnWidths;
windowHeights = getProportions heightDivisions; windowHeights = getProportions heightDivisions;
windowHeightsFiltered = builtins.filter (x: builtins.lessThan x.proportion 1.0) windowHeights; windowHeightsFiltered = builtins.filter (x: builtins.lessThan x.proportion 1.0) windowHeights;
in in
{ {
## Goals: flake.nixosModules.niri-binds =
## - Way to open new windows in specific areas of the creen {
## - Way to spawn terminals floating config,
## - Interact with Noctalia shell more with binds pkgs,
# credit sodiboo for this one in particular lib,
...
}:
{
# for home manager functionality
imports = [ inputs.home-manager.nixosModules.home-manager ];
# niri personalisation
home-manager.users.serenity = {
imports = [ inputs.niri.homeModules.niri ];
# black magic for column widths
programs.niri.settings.layout = { programs.niri.settings.layout = {
preset-column-widths = preset-column-widths =
builtins.sort builtins.sort
@ -58,14 +75,13 @@ in
(a: b: builtins.lessThan a.proportion b.proportion) (a: b: builtins.lessThan a.proportion b.proportion)
columnWidthsFiltered; columnWidthsFiltered;
default-column-width.proportion = 1.0 / 3.0; default-column-width.proportion = 1.0 / 3.0;
preset-window-heights = builtins.sort ( preset-window-heights = builtins.sort (
a: b: builtins.lessThan a.proportion b.proportion a: b: builtins.lessThan a.proportion b.proportion
) windowHeightsFiltered; ) windowHeightsFiltered;
}; };
programs.niri.settings.binds = with config.lib.niri.actions; {
## Window manager controls # actual keybinds
programs.niri.settings.binds = with config.lib.niri.actions; {
# Debug & Utility # Debug & Utility
"Mod+Shift+Slash".action = show-hotkey-overlay; # I am forgetful "Mod+Shift+Slash".action = show-hotkey-overlay; # I am forgetful
@ -154,4 +170,6 @@ in
#"Mod+hypothetical+bind".action.record-entire-screen = {show-pointer = true;}; #"Mod+hypothetical+bind".action.record-entire-screen = {show-pointer = true;};
#"Mod+hypothetical+bind".action.record-all-screens = {show-pointer = true;}; #"Mod+hypothetical+bind".action.record-all-screens = {show-pointer = true;};
}; };
};
};
} }

View file

@ -1,5 +1,7 @@
_: { self, inputs, ... }:
let let
windowRules = [ windowRules = [
{ {
geometry-corner-radius = geometry-corner-radius =
@ -38,7 +40,7 @@ let
title = "btop"; title = "btop";
} }
]; ];
open-on-output = "DP-1"; open-on-output = "DP-4";
open-on-workspace = "System"; open-on-workspace = "System";
open-maximized = true; open-maximized = true;
} }
@ -48,8 +50,16 @@ let
open-focused = true; open-focused = true;
} }
]; ];
in in
{ {
flake.nixosModules.niri-window-rules = { pkgs, ... }: {
# for home manager functionality
imports = [ inputs.home-manager.nixosModules.home-manager ];
home-manager.users.serenity = {
programs.niri.settings = { programs.niri.settings = {
window-rules = windowRules; window-rules = windowRules;
layout = { layout = {
@ -62,4 +72,6 @@ in
} }
]; ];
}; };
};
};
} }