nixos-config/modules/home/niri.nix

454 lines
15 KiB
Nix
Raw Normal View History

2025-03-05 10:32:45 -05:00
{
config,
nix-config,
pkgs,
...
}:
2025-02-08 10:27:43 -05:00
with pkgs.lib.nix-rice;
2025-03-05 10:32:45 -05:00
let
strPalette = palette.toRGBHex pkgs.rice.colorPalette;
in
{
2025-02-06 13:56:58 -05:00
programs = {
niri = {
settings = {
2025-03-05 10:32:45 -05:00
# hotkey-overlay.skip-at-startup = true;
2025-02-06 13:56:58 -05:00
screenshot-path = "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png";
prefer-no-csd = true;
spawn-at-startup = [
2025-03-05 10:32:45 -05:00
{
command = [
"clipse"
"-listen"
];
}
{
command = [
"systemctl"
"--user"
"restart"
"xwayland-satellite.service"
];
}
2025-02-25 12:40:13 -05:00
{ command = [ "sleep5; ${nix-config.packages.x86_64-linux.filen-desktop}/bin/filen-desktop" ]; }
2025-02-06 13:56:58 -05:00
];
workspaces = {
2025-03-05 10:32:45 -05:00
"main" = { };
"scratchpad" = { };
2025-02-06 13:56:58 -05:00
};
2025-03-05 10:32:45 -05:00
input = {
2025-02-23 17:03:37 -05:00
keyboard.xkb = {
layout = "us";
options = "compose:ralt";
};
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
touchpad = {
2025-02-06 13:56:58 -05:00
natural-scroll = true;
scroll-method = "two-finger";
2025-02-20 13:51:36 -05:00
dwt = false;
2025-02-06 13:56:58 -05:00
tap = false;
tap-button-map = "left-right-middle";
click-method = "clickfinger";
};
mouse = {
natural-scroll = true;
accel-speed = 0.1;
accel-profile = "adaptive";
};
workspace-auto-back-and-forth = true;
};
outputs = {
"eDP-1" = {
mode = {
2025-02-06 18:58:39 -05:00
width = 2560;
height = 1600;
2025-02-06 13:56:58 -05:00
};
2025-02-08 10:27:43 -05:00
background-color = strPalette.normal.background;
2025-02-06 13:56:58 -05:00
scale = 1;
2025-02-06 18:58:39 -05:00
variable-refresh-rate = true;
2025-02-06 13:56:58 -05:00
};
2025-02-07 18:15:39 -05:00
"HDMI-A-1" = {
2025-02-08 10:27:43 -05:00
background-color = strPalette.normal.background;
2025-02-07 18:15:39 -05:00
scale = 1;
};
2025-02-06 13:56:58 -05:00
"PNP(BNQ) BenQ PD2725U N2N00414019" = {
mode = {
2025-02-06 18:58:39 -05:00
width = 3840;
height = 2160;
2025-02-06 13:56:58 -05:00
};
2025-02-08 10:27:43 -05:00
background-color = strPalette.normal.background;
2025-02-06 13:56:58 -05:00
scale = 1;
};
};
environment = {
DISPLAY = ":0";
QT_QPA_PLATFORM = "wayland";
XDG_CURRENT_DESKTOP = "niri";
XDG_SESSION_TYPE = "wayland";
MOZ_ENABLE_WAYLAND = "1";
};
cursor = {
2025-02-09 22:09:10 -05:00
theme = "Bibata-Modern-Classic";
# size = 32;
2025-02-06 13:56:58 -05:00
hide-after-inactive-ms = 30000;
};
animations.slowdown = 1.0;
layout = {
gaps = 10;
center-focused-column = "never";
always-center-single-column = true;
preset-column-widths = [
2025-03-05 10:32:45 -05:00
{ proportion = 0.33333; }
{ proportion = 0.5; }
{ proportion = 0.66667; }
2025-02-06 13:56:58 -05:00
];
preset-window-heights = [
{ proportion = 1. / 3.; }
{ proportion = 1. / 2.; }
{ proportion = 2. / 3.; }
];
2025-03-05 10:32:45 -05:00
default-column-width = {
proportion = 0.5;
};
2025-02-06 13:56:58 -05:00
focus-ring = {
enable = true;
2025-03-05 10:32:45 -05:00
active.color =
with pkgs.rice.colorPalette.normal.border;
2025-02-08 23:50:39 -05:00
"rgba(${toString r} ${toString g} ${toString b} ${toString a})";
2025-02-06 13:56:58 -05:00
width = 2;
};
border = {
enable = true;
inactive = {
gradient = {
from = "#333333";
to = "#000000";
angle = 180;
in' = "srgb-linear";
};
};
active.color = "#000";
width = 2;
};
};
window-rules = [
# global window rule for shared config
2025-02-27 17:16:39 -05:00
{
geometry-corner-radius = {
top-left = pkgs.rice.corner-radius;
top-right = pkgs.rice.corner-radius;
bottom-left = pkgs.rice.corner-radius;
bottom-right = pkgs.rice.corner-radius;
2025-02-06 13:56:58 -05:00
};
2025-02-27 17:16:39 -05:00
clip-to-geometry = true;
}
2025-02-06 13:56:58 -05:00
2025-02-27 17:16:39 -05:00
{
matches = [
2025-03-05 10:32:45 -05:00
{ app-id = "Calculator"; }
{ app-id = "Color Picker"; }
{ app-id = "Volume Control"; }
{ app-id = "processing-core-PApplet"; }
2025-02-06 13:56:58 -05:00
];
2025-02-27 17:16:39 -05:00
open-floating = true;
}
2025-02-06 13:56:58 -05:00
2025-02-27 17:16:39 -05:00
{
matches = [
2025-03-05 10:32:45 -05:00
{ app-id = "Plexamp"; }
{ app-id = "scratchpad"; }
2025-02-06 13:56:58 -05:00
];
open-on-workspace = "scratchpad";
2025-02-27 17:16:39 -05:00
open-floating = true;
}
2025-02-06 13:56:58 -05:00
2025-02-27 17:16:39 -05:00
{
2025-03-05 10:32:45 -05:00
matches = [ { app-id = "launcher"; } ];
2025-02-08 23:50:39 -05:00
open-floating = true;
focus-ring = {
enable = true;
active.gradient = {
from = strPalette.normal.magenta;
2025-02-09 00:31:36 -05:00
to = strPalette.normal.cyan;
2025-02-27 17:16:39 -05:00
angle = 120;
2025-02-08 23:50:39 -05:00
in' = "srgb-linear";
};
width = 2;
};
}
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
{
# Open the Firefox picture-in-picture player as floating by default.
2025-02-11 12:46:32 -05:00
# This app-id regular expression will work for both:
2025-02-06 13:56:58 -05:00
# host Firefox (app-id is "firefox")
# Flatpak Firefox (app-id is "org.mozilla.firefox")
2025-03-05 10:32:45 -05:00
matches = [ { app-id = "r#\"librewolf$\"# title=\"^Picture-in-Picture$\""; } ];
2025-02-11 12:46:32 -05:00
open-floating = true;
}
2025-03-05 10:32:45 -05:00
{
matches = [
{ app-id = "Renoise"; }
{ app-id = "Bitwig"; }
{ app-id = "labwc"; }
];
2025-02-11 12:46:32 -05:00
open-maximized = true;
}
2025-02-06 13:56:58 -05:00
];
2025-02-14 16:37:28 -05:00
switch-events = with config.lib.niri.actions; {
lid-close.action = spawn "shikanectl switch desk-clam";
2025-02-14 17:37:01 -05:00
lid-open.action = spawn "niri msg output eDP-1 on && shikanectl reload";
2025-02-14 16:37:28 -05:00
};
2025-02-06 18:58:39 -05:00
2025-03-05 10:32:45 -05:00
binds =
with config.lib.niri.actions;
let
wez =
spawn "wezterm" "--config-file" "/home/emenel/.config/wezterm/launcher.lua" "start"
"--always-new-process";
wezlaunch = wez "--class" "launcher";
in
{
# shows a list of important hotkeys.
"Mod+Shift+Slash".action = show-hotkey-overlay;
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
"Mod+Space" = {
hotkey-overlay.title = "Launcher";
action = wezlaunch "sway-launcher-desktop";
};
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
"Print" = {
hotkey-overlay.title = "Launcher (alternative key)";
action = wezlaunch "sway-launcher-desktop";
};
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
"Mod+Ctrl+T" = {
hotkey-overlay.title = "Wezterm";
action = spawn "wezterm";
};
"Mod+Ctrl+E" = {
hotkey-overlay.title = "Emacs (client)";
action = spawn "emacsclient" "-r" "-n";
};
"Mod+Ctrl+B" = {
hotkey-overlay.title = "Librewolf Browser";
action = spawn "librewolf";
};
"Mod+Ctrl+V" = {
hotkey-overlay.title = "Clipboard History";
action = wezlaunch "clipse";
};
"Mod+Ctrl+F" = {
hotkey-overlay.title = "Yazi";
action = wez "yazi";
};
"Mod+Ctrl+N" = {
hotkey-overlay.title = "Notifications";
action = spawn "swaync-client" "-t";
};
"Mod+Ctrl+O" = {
hotkey-overlay.title = "Obsidian";
action = spawn "obsidian";
};
"Mod+Ctrl+S" = {
hotkey-overlay.title = "Signal";
action = spawn "signal";
};
"Mod+Ctrl+C" = {
hotkey-overlay.title = "Calendar";
action = spawn "gnome-calendar";
};
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
"Mod+Shift+A" = {
hotkey-overlay.title = "Lock Session";
action = spawn "hyprlock";
};
2025-02-18 17:49:48 -05:00
2025-03-05 10:32:45 -05:00
"XF86AudioPlay" = {
allow-when-locked = true;
action = spawn "playerctl" "play-pause";
};
"XF86AudioNext" = {
allow-when-locked = true;
action = spawn "playerctl" "next";
};
"XF86AudioPrev" = {
allow-when-locked = true;
action = spawn "playerctl" "previous";
};
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
"XF86AudioRaiseVolume" = {
allow-when-locked = true;
action = spawn "swayosd-client" "--output-volume" "raise";
};
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
"XF86AudioLowerVolume" = {
allow-when-locked = true;
action = spawn "swayosd-client" "--output-volume" "lower";
};
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
"XF86AudioMute" = {
allow-when-locked = true;
action = spawn "swayosd-client" "--output-volume" "mute-toggle";
};
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
"XF86AudioMicMute" = {
allow-when-locked = true;
action = spawn "swayosd-client" "--input-volume" "mute-toggle";
};
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
"XF86MonBrightnessUp" = {
allow-when-locked = true;
action = spawn "swayosd-client" "--brightness" "raise";
};
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
"XF86MonBrightnessDown" = {
allow-when-locked = true;
action = spawn "swayosd-client" "--brightness" "lower";
};
2025-02-06 13:56:58 -05:00
2025-03-05 10:32:45 -05:00
"Mod+Q".action = close-window;
"Mod+Left".action = focus-column-left;
"Mod+Down".action = focus-window-down;
"Mod+Up".action = focus-window-up;
"Mod+Right".action = focus-column-right;
"Mod+H".action = focus-column-left;
"Mod+J".action = focus-window-down;
"Mod+K".action = focus-window-up;
"Mod+L".action = focus-column-right;
"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;
"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;
"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;
"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;
"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;
"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;
"Mod+WheelScrollDown" = {
action = focus-workspace-down;
cooldown-ms = 150;
};
"Mod+WheelScrollUp" = {
action = focus-workspace-up;
cooldown-ms = 150;
};
"Mod+Ctrl+WheelScrollDown" = {
action = move-column-to-workspace-down;
cooldown-ms = 150;
};
"Mod+Ctrl+WheelScrollUp" = {
action = move-column-to-workspace-up;
cooldown-ms = 150;
};
"Mod+WheelScrollRight".action = focus-column-right;
"Mod+WheelScrollLeft".action = focus-column-left;
"Mod+Ctrl+WheelScrollRight".action = move-column-right;
"Mod+Ctrl+WheelScrollLeft".action = move-column-left;
"Mod+Shift+WheelScrollDown".action = focus-column-right;
"Mod+Shift+WheelScrollUp".action = focus-column-left;
"Mod+Ctrl+Shift+WheelScrollDown".action = move-column-right;
"Mod+Ctrl+Shift+WheelScrollUp".action = move-column-left;
"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;
"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+C".action = center-column;
"Mod+Minus".action = set-column-width "-10%";
"Mod+Equal".action = set-column-width "+10%";
"Mod+Shift+Minus".action = set-window-height "-10%";
"Mod+Shift+Equal".action = set-window-height "+10%";
"Mod+Ctrl+X".action = toggle-window-floating;
"Mod+X".action = switch-focus-between-floating-and-tiling;
"Mod+S".action = focus-workspace "scratchpad";
"Mod+Print".action = screenshot;
"Mod+Ctrl+Print".action = screenshot-screen;
"Mod+Alt+Print".action = screenshot-window;
# The quit action will show a confirmation dialog to avoid accidental exits.
"Mod+Shift+E".action = quit;
# Powers off the monitors. To turn them back on, do any input like
# moving the mouse or pressing any other key.
"Mod+Shift+P".action = power-off-monitors;
"Mod+Shift+Alt+P" = {
hotkey-overlay.title = "Turn Laptop Display On";
action = spawn "niri msg output eDP-1 on";
};
};
2025-02-06 13:56:58 -05:00
};
};
};
}