Files
nix-dotfiles-v2/home/niri.nix
T

670 lines
18 KiB
Nix

{
pkgs,
config,
lib,
inputs,
...
}:
let
palette = config.colorScheme.palette;
noctalia-bin = lib.getExe inputs.noctalia.packages.${pkgs.stdenv.hostPlatform.system}.default;
noctalia =
cmd:
[
noctalia-bin
"msg"
]
++ (lib.splitString " " cmd);
in
{
programs.niri = {
enable = true;
package = pkgs.niri;
settings = {
# Input configuration
input = {
keyboard.xkb = {
layout = "us,no";
};
touchpad = {
tap = true;
natural-scroll = true;
accel-speed = 0.1;
accel-profile = "flat";
};
warp-mouse-to-focus.enable = true;
focus-follows-mouse = {
enable = true;
max-scroll-amount = "0%";
};
};
# Output configurations
outputs = {
# Laptop display
"AU Optronics 0x212B Unknown" = {
mode = {
width = 3840;
height = 2160;
refresh = 60.002;
};
scale = 2.0;
transform.rotation = 0;
position = {
x = 1920;
y = 2160;
};
};
"ASUSTek COMPUTER INC ASUS MB16AH L9LMTF068515" = {
mode = {
width = 1920;
height = 1080;
refresh = 60.0;
};
scale = 1.0;
transform.rotation = 0;
position = {
x = 1920;
y = 1080;
};
};
"Hewlett Packard HP ZR24w CNT01710L4" = {
mode = {
width = 1920;
height = 1200;
refresh = 60.0;
};
scale = 1.0;
transform.rotation = 0;
position = {
x = 960;
y = 960;
};
};
"Hewlett Packard HP ZR24w CNT0181039" = {
mode = {
width = 1920;
height = 1200;
refresh = 60.0;
};
scale = 1.0;
transform.rotation = 0;
position = {
x = 2880;
y = 960;
};
};
# PVV demiurgen
"Ancor Communications Inc MG248 G7LMQS010063" = {
mode = {
width = 1920;
height = 1080;
refresh = 60.0;
};
scale = 1.0;
position = {
x = 1050;
y = 1080;
};
};
"ASUSTek COMPUTER INC MG248 K2LMQS048969" = {
mode = {
width = 1920;
height = 1080;
refresh = 60.0;
};
scale = 1.0;
position = {
x = 2970;
y = 1080;
};
};
# Desktop outputs
"Dell Inc. DELL U2410 F525M06G123L" = {
mode = {
width = 2560;
height = 1440;
refresh = 144.0;
};
scale = 1.0;
transform.rotation = 90;
position = {
x = 0;
y = 0;
};
};
"Samsung Electric Company LC27G5xT H4LR800468" = {
mode = {
width = 1920;
height = 1200;
refresh = 59.950;
};
variable-refresh-rate = "on-demand";
scale = 1.0;
transform.rotation = 0;
position = {
x = 1200;
y = 240;
};
};
};
# Switch events for lid open/close
switch-events = {
lid-close.action.spawn = noctalia "session lock";
tablet-mode-on.action.spawn = [
"bash"
"-c"
"wvkbd-mobintl"
];
tablet-mode-off.action.spawn = [
"bash"
"-c"
"pkill wvkbd-mobintl"
];
};
# Layout settings
layout = {
gaps = 8;
center-focused-column = "on-overflow";
preset-column-widths = [
{ proportion = 0.3333333; }
{ proportion = 0.5; }
{ proportion = 0.6666667; }
];
preset-window-heights = [
{ proportion = 1.0; }
{ proportion = 0.5; }
];
default-column-width = {
proportion = 1.0;
};
focus-ring = {
enable = true;
width = 2;
active.color = "#${palette.base0D}";
inactive.color = "#${palette.base03}";
};
border = {
enable = false;
width = 2;
active.color = "#${palette.base0A}";
inactive.color = "#${palette.base03}";
};
shadow = {
enable = true;
softness = 30;
spread = 5;
offset = {
x = 0;
y = 5;
};
color = "#0007";
};
struts = {
left = 24;
right = 24;
};
};
# Overview
overview = {
zoom = 0.5;
backdrop-color = "#${palette.base00}";
};
# Spawn at startup
spawn-at-startup = [
{
argv = [
"foot"
"--server"
];
}
{
argv = [
noctalia-bin
];
}
];
# Prefer no CSD
prefer-no-csd = true;
# Screenshot path
screenshot-path = "~/Pictures/screenshots/screenshot-%Y-%m-%d %H-%M-%S.png";
# Animations (off)
animations.enable = false;
# Layer rules
layer-rules = [
{
matches = [ { namespace = "^notifications$"; } ];
block-out-from = "screencast";
}
{
matches = [ { namespace = "noctalia-overview*"; } ];
place-within-backdrop = true;
}
{
matches = [ { namespace = "^noctalia-backdrop"; } ];
place-within-backdrop = true;
}
];
# Window rules
window-rules = [
# Bitwarden extension popup
{
matches = [
{ title = "^Extension: (Bitwarden Password Manager) - Bitwarden — Mozilla Firefox$"; }
];
open-floating = true;
default-column-width = {
proportion = 0.3;
};
default-floating-position = {
x = 0;
y = 0;
relative-to = "top-left";
};
opacity = 0.9;
block-out-from = "screen-capture";
}
# KDE Connect
{
matches = [ { app-id = "org.kde.kdeconnect.daemon"; } ];
open-floating = true;
open-fullscreen = false;
default-floating-position = {
x = 0;
y = 0;
relative-to = "top-left";
};
min-width = 1920;
min-height = 1080;
focus-ring.enable = false;
border.enable = false;
shadow.enable = false;
draw-border-with-background = false;
}
# Firefox extension windows
{
matches = [ { app-id = "firefox$"; } ];
excludes = [ { title = ".*Mozilla Firefox.*"; } ];
open-floating = true;
default-column-width = {
proportion = 0.5;
};
max-width = 720;
}
# Foot smaller by default
{
matches = [ { title = "^foot$"; } ];
open-focused = true;
default-column-width = {
proportion = 0.5;
};
}
#noctalia settings
{
matches = [
{ app-id = "dev.noctalia.Noctalia.Settings"; }
];
opacity = 0.9;
draw-border-with-background = false;
open-floating = true;
default-column-width = {
proportion = 0.5;
};
default-window-height = {
proportion = 0.7;
};
default-floating-position = {
x = 0;
y = 20;
relative-to = "top";
};
}
# Steam notifications
{
matches = [
{
app-id = "steam";
title = ''^notificationtoasts_\d+_desktop$'';
}
];
default-floating-position = {
x = 10;
y = 10;
relative-to = "bottom-right";
};
block-out-from = "screen-capture";
}
# Global corner radius
{
geometry-corner-radius =
let
r = 12.0;
in
{
top-left = r;
top-right = r;
bottom-left = r;
bottom-right = r;
};
clip-to-geometry = true;
}
# Onboard keyboard
{
matches = [
{ app-id = "onboard"; }
{ app-id = "Onboard"; }
];
open-floating = true;
default-window-height = {
proportion = 0.2;
};
default-column-width = {
proportion = 0.8;
};
block-out-from = "screen-capture";
}
];
# Keybindings
binds = {
# Hotkey overlay
"Mod+Shift+Slash".action.show-hotkey-overlay = { };
"Mod+Slash".action.toggle-overview = { };
# Applications
"Mod+Return".action.spawn = "footclient";
#"Mod+T".action.spawn = noctalia "plugin togglePanel notes-scratchpad";
#"Mod+A".action.spawn = noctalia "plugin:assistant-panel open";
#"Mod+D".action.spawn = "fuzzel";
"Mod+D".action.spawn = noctalia "panel-toggle launcher";
"Mod+Space".action.spawn = noctalia "panel-toggle launcher";
"Mod+O".action.toggle-window-rule-opacity = { };
# Noctalia lock screen
"Mod+M".action.spawn = noctalia "session lock";
"Mod+Shift+E".action.spawn = noctalia "panel-toggle session";
"Ctrl+Alt+Delete".action.spawn = noctalia "panel-toggle session";
# Power off monitors
"Mod+Shift+P".action.power-off-monitors = { };
# Noctalia control center
"Mod+N".action.spawn = noctalia "panel-toggle control-center";
"Mod+S".action.spawn = noctalia "settings-toggle";
# Volume keys (using Noctalia)
"XF86AudioRaiseVolume" = {
allow-when-locked = true;
action.spawn = noctalia "volume-up";
};
"XF86AudioLowerVolume" = {
allow-when-locked = true;
action.spawn = noctalia "volume-down";
};
"XF86AudioMute" = {
allow-when-locked = true;
action.spawn = noctalia "volume-mute";
};
"XF86AudioMicMute" = {
allow-when-locked = true;
action.spawn = noctalia "mic-mute";
};
"XF86MonBrightnessUp" = {
allow-when-locked = true;
action.spawn = noctalia "brightness-up";
};
"XF86MonBrightnessDown" = {
allow-when-locked = true;
action.spawn = noctalia "brightness-down";
};
# Window management
"Mod+Shift+Q".action.close-window = { };
# Focus navigation
"Mod+Left".action.focus-column-or-monitor-left = { };
"Mod+Down".action.focus-window-or-monitor-down = { };
"Mod+Up".action.focus-window-or-monitor-up = { };
"Mod+Right".action.focus-column-or-monitor-right = { };
"Mod+H".action.focus-column-or-monitor-left = { };
"Mod+J".action.focus-window-or-monitor-down = { };
"Mod+K".action.focus-window-or-monitor-up = { };
"Mod+L".action.focus-column-or-monitor-right = { };
# Move windows
"Mod+Ctrl+Left".action.move-column-left = { };
"Mod+Ctrl+Down".action.move-window-down = { };
"Mod+Ctrl+Up".action.move-window-up = { };
"Mod+Ctrl+Right".action.move-column-right = { };
"Mod+Ctrl+H".action.move-column-left = { };
"Mod+Ctrl+J".action.move-window-down = { };
"Mod+Ctrl+K".action.move-window-up = { };
"Mod+Ctrl+L".action.move-column-right = { };
# First/last column
"Mod+Home".action.focus-column-first = { };
"Mod+End".action.focus-column-last = { };
"Mod+Ctrl+Home".action.move-column-to-first = { };
"Mod+Ctrl+End".action.move-column-to-last = { };
# Monitor focus
"Mod+Shift+Left".action.focus-monitor-left = { };
"Mod+Shift+Down".action.focus-monitor-down = { };
"Mod+Shift+Up".action.focus-monitor-up = { };
"Mod+Shift+Right".action.focus-monitor-right = { };
"Mod+Shift+H".action.focus-monitor-left = { };
"Mod+Shift+J".action.focus-monitor-down = { };
"Mod+Shift+K".action.focus-monitor-up = { };
"Mod+Shift+L".action.focus-monitor-right = { };
# Move to monitor
"Mod+Shift+Ctrl+Left".action.move-column-to-monitor-left = { };
"Mod+Shift+Ctrl+Down".action.move-column-to-monitor-down = { };
"Mod+Shift+Ctrl+Up".action.move-column-to-monitor-up = { };
"Mod+Shift+Ctrl+Right".action.move-column-to-monitor-right = { };
"Mod+Shift+Ctrl+H".action.move-column-to-monitor-left = { };
"Mod+Shift+Ctrl+J".action.move-column-to-monitor-down = { };
"Mod+Shift+Ctrl+K".action.move-column-to-monitor-up = { };
"Mod+Shift+Ctrl+L".action.move-column-to-monitor-right = { };
# Workspace navigation
"Mod+Page_Down".action.focus-workspace-down = { };
"Mod+Page_Up".action.focus-workspace-up = { };
"Mod+U".action.focus-workspace-down = { };
"Mod+I".action.focus-workspace-up = { };
"Mod+Ctrl+Page_Down".action.move-column-to-workspace-down = { };
"Mod+Ctrl+Page_Up".action.move-column-to-workspace-up = { };
"Mod+Ctrl+U".action.move-column-to-workspace-down = { };
"Mod+Ctrl+I".action.move-column-to-workspace-up = { };
# Move workspace
"Mod+Shift+Page_Down".action.move-workspace-down = { };
"Mod+Shift+Page_Up".action.move-workspace-up = { };
"Mod+Shift+U".action.move-workspace-down = { };
"Mod+Shift+I".action.move-workspace-up = { };
# Mouse wheel workspace/column navigation
"Mod+Shift+WheelScrollDown" = {
cooldown-ms = 150;
action.focus-workspace-down = { };
};
"Mod+Shift+WheelScrollUp" = {
cooldown-ms = 150;
action.focus-workspace-up = { };
};
"Mod+Shift+Ctrl+WheelScrollDown" = {
cooldown-ms = 150;
action.move-column-to-workspace-down = { };
};
"Mod+Ctrl+Shift+WheelScrollUp" = {
cooldown-ms = 150;
action.move-column-to-workspace-up = { };
};
"Mod+WheelScrollRight" = {
cooldown-ms = 150;
action.focus-column-right = { };
};
"Mod+WheelScrollLeft" = {
cooldown-ms = 150;
action.focus-column-left = { };
};
"Mod+Ctrl+WheelScrollRight" = {
cooldown-ms = 150;
action.move-column-right = { };
};
"Mod+Ctrl+WheelScrollLeft" = {
cooldown-ms = 150;
action.move-column-left = { };
};
"Mod+WheelScrollDown" = {
cooldown-ms = 150;
action.focus-column-right = { };
};
"Mod+WheelScrollUp" = {
cooldown-ms = 150;
action.focus-column-left = { };
};
"Mod+Ctrl+WheelScrollDown" = {
cooldown-ms = 150;
action.move-column-right = { };
};
"Mod+Ctrl+WheelScrollUp" = {
cooldown-ms = 150;
action.move-column-left = { };
};
# Workspace by index
"Mod+1".action.focus-workspace = 1;
"Mod+2".action.focus-workspace = 2;
"Mod+3".action.focus-workspace = 3;
"Mod+4".action.focus-workspace = 4;
"Mod+5".action.focus-workspace = 5;
"Mod+6".action.focus-workspace = 6;
"Mod+7".action.focus-workspace = 7;
"Mod+8".action.focus-workspace = 8;
"Mod+9".action.focus-workspace = 9;
"Mod+Ctrl+1".action.move-column-to-workspace = 1;
"Mod+Ctrl+2".action.move-column-to-workspace = 2;
"Mod+Ctrl+3".action.move-column-to-workspace = 3;
"Mod+Ctrl+4".action.move-column-to-workspace = 4;
"Mod+Ctrl+5".action.move-column-to-workspace = 5;
"Mod+Ctrl+6".action.move-column-to-workspace = 6;
"Mod+Ctrl+7".action.move-column-to-workspace = 7;
"Mod+Ctrl+8".action.move-column-to-workspace = 8;
"Mod+Ctrl+9".action.move-column-to-workspace = 9;
# Column operations
"Mod+BracketLeft".action.consume-or-expel-window-left = { };
"Mod+BracketRight".action.consume-or-expel-window-right = { };
"Mod+Comma".action.consume-window-into-column = { };
"Mod+Period".action.expel-window-from-column = { };
# Window sizing
"Mod+R".action.switch-preset-column-width = { };
"Mod+Shift+R".action.switch-preset-window-height = { };
"Mod+Ctrl+R".action.reset-window-height = { };
"Mod+F".action.maximize-column = { };
"Mod+Shift+F".action.fullscreen-window = { };
"Mod+Ctrl+Shift+F".action.toggle-windowed-fullscreen = { };
"Mod+Ctrl+F".action.expand-column-to-available-width = { };
"Mod+C".action.center-column = { };
# Width/height adjustments
"Mod+Minus".action.set-column-width = "-10%";
"Mod+Equal".action.set-column-width = "+10%";
"Mod+0".action.set-column-width = "+10%";
"Mod+Shift+Minus".action.set-window-height = "-10%";
"Mod+Shift+Equal".action.set-window-height = "+10%";
"Mod+Shift+0".action.set-window-height = "+10%";
# Floating/tiling
"Mod+V".action.toggle-window-floating = { };
"Mod+Shift+V".action.switch-focus-between-floating-and-tiling = { };
# Tabbed display
"Mod+W".action.toggle-column-tabbed-display = { };
# Screenshots
"Print".action.screenshot = { };
"Ctrl+Print".action.screenshot-screen = { };
"Alt+Print".action.screenshot-window = { };
# Inhibitor escape
"Mod+Escape" = {
allow-inhibiting = false;
action.toggle-keyboard-shortcuts-inhibit = { };
};
};
# Environment variables
environment = {
ELECTRON_OZONE_PLATFORM_HINT = "auto";
};
};
};
home.packages = with pkgs; [
# niri is now managed by programs.niri
# noctalia-shell is managed by programs.noctalia-shell
wl-clipboard
wtype
pass-wayland
wev
wdisplays
xwayland-satellite
xwayland
gtk3
networkmanagerapplet
networkmanager-openconnect
networkmanager
brightnessctl
emote
wvkbd
udiskie
];
}