feat: Niri additions

- Switch to unstable branch.
- Run xwayland-sattelite as a serivce.
- Initialise terminal windows at smaller widths.
- Style & bind tabs.
- Block out private windows.
- Binds for dynamic casting.
This commit is contained in:
Madeleine Sydney
2025-03-30 02:59:48 -06:00
parent 370687f1e2
commit 52f56d5437
3 changed files with 69 additions and 10 deletions

View File

@@ -73,7 +73,7 @@
videoDrivers = [ "nvidia" ]; videoDrivers = [ "nvidia" ];
xkb = { xkb = {
layout = "us"; layout = "us";
options = "ctrl:swapcaps"; options = "ctrl:swapcaps,compose:menu";
}; };
}; };

View File

@@ -24,6 +24,14 @@ in {
services.polkit-gnome.enable = true; services.polkit-gnome.enable = true;
systemd.user.services.xwayland-satellite =
lib.mkIf cfg.xwayland-satellite.enable {
Service.ExecStart =
["${pkgs.xwayland-satellite}/bin/xwayland-satellite"];
Unit.After = ["niri.service"];
Unit.PartOf = ["niri.service"];
};
programs.niri = { programs.niri = {
# Activates some Nixpkgs patches to help run Electron applications under # Activates some Nixpkgs patches to help run Electron applications under
# Wayland. # Wayland.
@@ -33,9 +41,6 @@ in {
spawn-at-startup = spawn-at-startup =
[{ command = [ "${pkgs.swaynotificationcenter}/bin/swaync" ]; }] [{ command = [ "${pkgs.swaynotificationcenter}/bin/swaync" ]; }]
++ lib.optional
cfg.xwayland-satellite.enable
{ command = [ "${pkgs.xwayland-satellite}/bin/xwayland-satellite" ]; }
++ lib.optional ++ lib.optional
(! builtins.isNull cfg.wallpaper) (! builtins.isNull cfg.wallpaper)
{ command = [ "${pkgs.wbg}/bin/wbg" "${cfg.wallpaper}" ]; }; { command = [ "${pkgs.wbg}/bin/wbg" "${cfg.wallpaper}" ]; };
@@ -85,6 +90,15 @@ in {
offset.x = 5; offset.x = 5;
offset.y = 5; offset.y = 5;
}; };
tab-indicator = {
place-within-column = true;
position = "top";
# active.color = config.lib.stylix.colors.withHashtag.blue;
inactive.color = config.lib.stylix.colors.withHashtag.base01;
width = 8;
corner-radius = 2.0;
gaps-between-tabs = 10;
};
}; };
prefer-no-csd = true; prefer-no-csd = true;
screenshot-path = "~/Pictures/Screenshots/%Y-%m-%d %H-%M-%S.png"; screenshot-path = "~/Pictures/Screenshots/%Y-%m-%d %H-%M-%S.png";
@@ -93,9 +107,41 @@ in {
size = 24; size = 24;
}; };
window-rules = [ window-rules = [
{ { # Set red borders to indicate that a window is being captured.
matches = [ matches = [
{ title = "Element.*wishdir"; } { is-window-cast-target = true; }
];
focus-ring = {
enable = true;
width = 2;
active.color = "#f38ba8";
inactive.color = "#7d0d2d";
};
border = {
width = 2;
inactive.color = "#7d0d2d";
active.color = "#7d0d2d";
};
shadow = {
color = "#7d0d2d70";
softness = 30;
spread = 10;
offset.x = 0;
offset.y = 0;
};
tab-indicator = {
active.color = "#f38ba8";
inactive.color = "#7d0d2d";
};
}
{ # Block private DMs from screencast...
matches = [
{ title = "Element \\|"; }
{ title = "^Discord \\| @"; }
];
excludes = [
# ... except when explicitly targeting the window.
{ is-window-cast-target = true; }
]; ];
block-out-from = "screen-capture"; block-out-from = "screen-capture";
} }
@@ -116,6 +162,13 @@ in {
]; ];
open-floating = true; open-floating = true;
} }
{ # Start terminals with low width.
matches = [
{ app-id = "com\\.mitchellh\\.ghostty"; }
{ title = "^\\*eshell\\*"; }
];
default-column-width.proportion = 1.0 / 3.0;
}
{ {
# Enable rounded corners for all windows. # Enable rounded corners for all windows.
geometry-corner-radius = geometry-corner-radius =
@@ -136,10 +189,14 @@ in {
"Mod+D".action.spawn = ["${pkgs.fuzzel}/bin/fuzzel"]; "Mod+D".action.spawn = ["${pkgs.fuzzel}/bin/fuzzel"];
"Mod+Shift+Slash".action.show-hotkey-overlay = []; "Mod+Shift+Slash".action.show-hotkey-overlay = [];
# Powers off the monitors. To turn them back on, do any input like # Powers off the monitors. They will be powered back on upon any
# moving the mouse or pressing any other key. # keyboard/mouse input.
"Mod+Shift+P".action.power-off-monitors = []; "Mod+Shift+P".action.power-off-monitors = [];
"Mod+I".action.set-dynamic-cast-window = [];
"Mod+Shift+I".action.set-dynamic-cast-monitor = [];
"Mod+Ctrl+I".action.clear-dynamic-cast-target = [];
"Mod+BracketLeft".action.consume-or-expel-window-left = []; "Mod+BracketLeft".action.consume-or-expel-window-left = [];
"Mod+BracketRight".action.consume-or-expel-window-right = []; "Mod+BracketRight".action.consume-or-expel-window-right = [];
"Mod+Comma".action.consume-window-into-column = []; "Mod+Comma".action.consume-window-into-column = [];
@@ -154,8 +211,7 @@ in {
"Mod+C".action.center-column = []; "Mod+C".action.center-column = [];
"Mod+M".action.maximize-column = []; "Mod+M".action.maximize-column = [];
"Mod+Shift+M".action.fullscreen-window = []; "Mod+Shift+M".action.fullscreen-window = [];
# Currently unreleased }:(. "Mod+Ctrl+M".action.toggle-windowed-fullscreen = [];
# "Mod+Ctrl+M".action.toggle-windowed-fullscreen = [];
"Mod+Shift+S".action.screenshot = []; "Mod+Shift+S".action.screenshot = [];
"Print".action.screenshot-screen = []; "Print".action.screenshot-screen = [];

View File

@@ -8,11 +8,14 @@ in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
nixpkgs.overlays = [ inputs.niri.overlays.niri ]; nixpkgs.overlays = [ inputs.niri.overlays.niri ];
programs.niri = { programs.niri = {
enable = true; enable = true;
package = pkgs.niri-unstable; package = pkgs.niri-unstable;
}; };
security.pam.services.swaylock = {};
# Necessary for e.g. screensharing. # Necessary for e.g. screensharing.
xdg.portal = { xdg.portal = {
enable = true; enable = true;