feat(niri): commonize

This commit is contained in:
Ahurac 2024-10-15 09:45:54 +02:00
parent 394dfac838
commit 0560adc22a
2 changed files with 96 additions and 87 deletions

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { config, ... }:
{ {
imports = [ ../common/home.nix ]; imports = [ ../common/home.nix ];
@ -44,66 +44,18 @@
}; };
programs.niri = { programs.niri = {
enable = true;
package = pkgs.niri;
settings = { settings = {
input = { input = {
keyboard = { keyboard.xkb.layout = "fr";
xkb.layout = "fr";
xkb.options = "compose:rctrl";
repeat-delay = 300;
repeat-rate = 100;
};
touchpad = { touchpad = {
tap = true; tap = true;
natural-scroll = true; natural-scroll = true;
accel-profile = "flat"; accel-profile = "flat";
}; };
mouse.accel-profile = "flat";
warp-mouse-to-focus = true;
focus-follows-mouse.enable = true;
}; };
outputs."eDP-1" = { scale = 1; }; outputs."eDP-1" = { scale = 1; };
layout = { layout.border.active.color = "#35f835e5";
gaps = 10;
default-column-width.proportion = 0.5;
preset-window-heights = [{ proportion = 1.0 / 2.0; }];
focus-ring.enable = false;
border = {
enable = true;
width = 2;
active.color = "#35f835e5";
inactive.color = "#80808080";
};
};
workspaces = {
w1.name = "admin";
w2.name = "everything";
w3.name = "apps";
};
window-rules = [
{
matches =
[{ app-id = "^(im\\.riot\\.Riot|WebCord|@joplin/app-desktop)$"; }];
open-on-workspace = "apps";
}
{
geometry-corner-radius = {
top-left = 10.0;
top-right = 10.0;
bottom-right = 10.0;
bottom-left = 10.0;
};
clip-to-geometry = true;
}
];
prefer-no-csd = true;
screenshot-path = "~/screenshots/%Y%m%d%H%m%N.png";
binds = with config.lib.niri.actions; { binds = with config.lib.niri.actions; {
"Mod+Space".action = spawn "alacritty";
"Mod+Shift+Space".action = spawn "alacritty -e sudo -i";
"Mod+F1".action = spawn "anyrun";
"Mod+L".action = spawn "hyprlock";
"XF86AudioRaiseVolume" = { "XF86AudioRaiseVolume" = {
allow-when-locked = true; allow-when-locked = true;
action = spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; action = spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+";
@ -124,43 +76,8 @@
allow-when-locked = true; allow-when-locked = true;
action = spawn "brightnessctl" "set" "+10"; action = spawn "brightnessctl" "set" "+10";
}; };
"Mod+Shift+Q".action = close-window;
"Mod+A".action = focus-column-left;
"Mod+Z".action = focus-window-or-workspace-up;
"Mod+S".action = focus-window-or-workspace-down;
"Mod+D".action = focus-column-right;
"Mod+Shift+A".action = move-column-left;
"Mod+Shift+Z".action = move-window-up-or-to-workspace-up;
"Mod+Shift+S".action = move-window-down-or-to-workspace-down;
"Mod+Shift+D".action = move-column-right;
"Mod+Page_Up".action = focus-workspace-up;
"Mod+Page_Down".action = focus-workspace-down;
"Mod+WheelScrollDown".action = focus-column-right;
"Mod+WheelScrollUp".action = focus-column-left;
"Mod+Shift+WheelScrollDown".action = move-column-right;
"Mod+Shift+WheelScrollUp".action = move-column-left;
"Alt+TouchpadScrollDown".action = spawn "brightnessctl" "set" "10-"; "Alt+TouchpadScrollDown".action = spawn "brightnessctl" "set" "10-";
"Alt+TouchpadScrollUp".action = spawn "brightnessctl" "set" "+10"; "Alt+TouchpadScrollUp".action = spawn "brightnessctl" "set" "+10";
"Mod+ampersand".action = focus-workspace 1;
"Mod+eacute".action = focus-workspace 2;
"Mod+quotedbl".action = focus-workspace 3;
"Mod+apostrophe".action = focus-workspace 4;
"Mod+Shift+ampersand".action = move-column-to-workspace 1;
"Mod+Shift+eacute".action = move-column-to-workspace 2;
"Mod+Shift+quotedbl".action = move-column-to-workspace 3;
"Mod+Shift+apostrophe".action = move-column-to-workspace 4;
"Mod+Tab".action = focus-workspace-previous;
"Mod+F".action = maximize-column;
"Mod+W".action = set-column-width "-10%";
"Mod+X".action = set-column-width "+10%";
"Mod+Shift+W".action = set-window-height "-10%";
"Mod+Shift+X".action = set-window-height "+10%";
"Print".action = screenshot-screen;
"Shift+Print".action = screenshot;
"Alt+Print".action = screenshot-window;
"Mod+Shift+Backspace" = {
action = quit { skip-confirmation = true; };
};
"XF86Display".action = power-off-monitors; "XF86Display".action = power-off-monitors;
}; };
}; };

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { config, pkgs, ... }:
{ {
home.username = "ahurac"; home.username = "ahurac";
@ -487,4 +487,96 @@
}; };
Install = { WantedBy = [ "graphical-session.target" ]; }; Install = { WantedBy = [ "graphical-session.target" ]; };
}; };
programs.niri = {
enable = true;
package = pkgs.niri;
settings = {
input = {
keyboard = {
xkb.options = "compose:rctrl";
repeat-delay = 300;
repeat-rate = 100;
};
mouse.accel-profile = "flat";
warp-mouse-to-focus = true;
focus-follows-mouse.enable = true;
};
layout = {
gaps = 10;
default-column-width.proportion = 0.5;
preset-window-heights = [{ proportion = 1.0 / 2.0; }];
focus-ring.enable = false;
border = {
enable = true;
width = 2;
inactive.color = "#80808080";
};
};
workspaces = {
w1.name = "admin";
w2.name = "everything";
w3.name = "apps";
};
window-rules = [
{
matches =
[{ app-id = "^(im\\.riot\\.Riot|WebCord|@joplin/app-desktop)$"; }];
open-on-workspace = "apps";
}
{
geometry-corner-radius = {
top-left = 10.0;
top-right = 10.0;
bottom-right = 10.0;
bottom-left = 10.0;
};
clip-to-geometry = true;
}
];
prefer-no-csd = true;
screenshot-path = "~/screenshots/%Y%m%d%H%m%N.png";
binds = with config.lib.niri.actions; {
"Mod+Space".action = spawn "alacritty";
"Mod+Shift+Space".action = spawn "alacritty -e sudo -i";
"Mod+F1".action = spawn "anyrun";
"Mod+L".action = spawn "hyprlock";
"Mod+Shift+Q".action = close-window;
"Mod+A".action = focus-column-left;
"Mod+Z".action = focus-window-or-workspace-up;
"Mod+S".action = focus-window-or-workspace-down;
"Mod+D".action = focus-column-right;
"Mod+Shift+A".action = move-column-left;
"Mod+Shift+Z".action = move-window-up-or-to-workspace-up;
"Mod+Shift+S".action = move-window-down-or-to-workspace-down;
"Mod+Shift+D".action = move-column-right;
"Mod+Page_Up".action = focus-workspace-up;
"Mod+Page_Down".action = focus-workspace-down;
"Mod+WheelScrollDown".action = focus-column-right;
"Mod+WheelScrollUp".action = focus-column-left;
"Mod+Shift+WheelScrollDown".action = move-column-right;
"Mod+Shift+WheelScrollUp".action = move-column-left;
"Mod+ampersand".action = focus-workspace 1;
"Mod+eacute".action = focus-workspace 2;
"Mod+quotedbl".action = focus-workspace 3;
"Mod+apostrophe".action = focus-workspace 4;
"Mod+Shift+ampersand".action = move-column-to-workspace 1;
"Mod+Shift+eacute".action = move-column-to-workspace 2;
"Mod+Shift+quotedbl".action = move-column-to-workspace 3;
"Mod+Shift+apostrophe".action = move-column-to-workspace 4;
"Mod+Tab".action = focus-workspace-previous;
"Mod+F".action = maximize-column;
"Mod+W".action = set-column-width "-10%";
"Mod+X".action = set-column-width "+10%";
"Mod+Shift+W".action = set-window-height "-10%";
"Mod+Shift+X".action = set-window-height "+10%";
"Print".action = screenshot-screen;
"Shift+Print".action = screenshot;
"Alt+Print".action = screenshot-window;
"Mod+Shift+Backspace" = {
action = quit { skip-confirmation = true; };
};
};
};
};
} }