initial commit
This commit is contained in:
193
modules/home/niri/binds.nix
Normal file
193
modules/home/niri/binds.nix
Normal file
@@ -0,0 +1,193 @@
|
||||
{
|
||||
host,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (import ../../../hosts/${host}/variables.nix) browser terminal;
|
||||
in {
|
||||
programs.niri.settings = {
|
||||
binds = with config.lib.niri.actions; {
|
||||
# Terminal & application launcher
|
||||
"Mod+Return".action.spawn = "${terminal}";
|
||||
"Mod+D".action.spawn = "fuzzel";
|
||||
"Mod+R".action.spawn = "rofi-launcher";
|
||||
|
||||
# Window management
|
||||
"Mod+Q".action = close-window;
|
||||
"Mod+F".action = fullscreen-window;
|
||||
"Mod+Shift+F".action = maximize-column;
|
||||
"Mod+Shift+Space".action = toggle-window-floating;
|
||||
"Mod+Space".action = switch-focus-between-floating-and-tiling;
|
||||
|
||||
# Session control
|
||||
"Mod+Shift+E".action.quit = {skip-confirmation = false;};
|
||||
"Mod+Shift+Q".action.quit = {skip-confirmation = true;};
|
||||
"Mod+L" = {
|
||||
action.spawn = ["swaylock"];
|
||||
allow-when-locked = true;
|
||||
};
|
||||
|
||||
# Focus windows
|
||||
"Mod+Left".action = focus-column-left;
|
||||
"Mod+Right".action = focus-column-right;
|
||||
"Mod+Up".action = focus-window-up;
|
||||
"Mod+Down".action = focus-window-down;
|
||||
"Mod+Home".action = focus-column-first;
|
||||
"Mod+End".action = focus-column-last;
|
||||
|
||||
# Focus monitors
|
||||
"Mod+Shift+Left".action = focus-monitor-left;
|
||||
"Mod+Shift+Right".action = focus-monitor-right;
|
||||
"Mod+Shift+Up".action = focus-monitor-up;
|
||||
"Mod+Shift+Down".action = focus-monitor-down;
|
||||
|
||||
# Move windows within workspace
|
||||
"Mod+Ctrl+Left".action = move-column-left;
|
||||
"Mod+Ctrl+Right".action = move-column-right;
|
||||
"Mod+Ctrl+Up".action = move-window-up;
|
||||
"Mod+Ctrl+Down".action = move-window-down;
|
||||
"Mod+Ctrl+W".action = toggle-column-tabbed-display;
|
||||
"Mod+Ctrl+Home".action = move-column-to-first;
|
||||
"Mod+Ctrl+End".action = move-column-to-last;
|
||||
|
||||
# Move windows to monitors
|
||||
"Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left;
|
||||
"Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right;
|
||||
"Mod+Shift+Ctrl+Up".action = move-column-to-monitor-up;
|
||||
"Mod+Shift+Ctrl+Down".action = move-column-to-monitor-down;
|
||||
|
||||
# Workspaces
|
||||
"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+Page_Down".action = focus-workspace-down;
|
||||
"Mod+Page_Up".action = focus-workspace-up;
|
||||
|
||||
"Mod+Shift+1".action = {move-window-to-workspace = 1;};
|
||||
"Mod+Shift+2".action = {move-window-to-workspace = 2;};
|
||||
"Mod+Shift+3".action = {move-window-to-workspace = 3;};
|
||||
"Mod+Shift+4".action = {move-window-to-workspace = 4;};
|
||||
"Mod+Shift+5".action = {move-window-to-workspace = 5;};
|
||||
"Mod+Shift+6".action = {move-window-to-workspace = 6;};
|
||||
"Mod+Shift+7".action = {move-window-to-workspace = 7;};
|
||||
"Mod+Shift+8".action = {move-window-to-workspace = 8;};
|
||||
"Mod+Shift+9".action = {move-window-to-workspace = 9;};
|
||||
|
||||
"Mod+Shift+Page_Down".action = move-window-to-workspace-down;
|
||||
"Mod+Shift+Page_Up".action = move-window-to-workspace-up;
|
||||
|
||||
"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;};
|
||||
|
||||
"Mod+Ctrl+Page_Down".action = move-column-to-workspace-down;
|
||||
"Mod+Ctrl+Page_Up".action = move-column-to-workspace-up;
|
||||
|
||||
# Layout & Sizing
|
||||
"Mod+Plus".action = {set-column-width = "+10%";};
|
||||
"Mod+Shift+Plus".action = {set-column-width = "+10";};
|
||||
"Mod+odiaeresis".action = {set-column-width = "-10%";};
|
||||
"Mod+Shift+odiaeresis".action = {set-column-width = "-10";};
|
||||
|
||||
"Mod+Ctrl+Plus".action = {set-window-height = "+10%";};
|
||||
"Mod+Ctrl+Shift+Plus".action = {set-window-height = "+10";};
|
||||
"Mod+Ctrl+odiaeresis".action = {set-window-height = "-10%";};
|
||||
"Mod+Ctrl+Shift+odiaeresis".action = {set-window-height = "-10";};
|
||||
|
||||
"Mod+Shift+R".action = reset-window-height;
|
||||
"Mod+comma".action = switch-preset-column-width;
|
||||
"Mod+period".action = switch-preset-window-height;
|
||||
"Mod+M".action = maximize-column;
|
||||
"Mod+C".action = center-column;
|
||||
|
||||
# Overview mode
|
||||
"Mod+Tab".action = toggle-overview;
|
||||
"Mod+numbersign".action = show-hotkey-overlay;
|
||||
|
||||
# Screenshots
|
||||
"Print".action.screenshot = {};
|
||||
"Ctrl+Print".action.screenshot-screen = {};
|
||||
"Alt+Print".action.screenshot-window = {};
|
||||
|
||||
# Media keys
|
||||
"XF86AudioRaiseVolume" = {
|
||||
action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"];
|
||||
allow-when-locked = true;
|
||||
};
|
||||
"XF86AudioLowerVolume" = {
|
||||
action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"];
|
||||
allow-when-locked = true;
|
||||
};
|
||||
"XF86AudioMute" = {
|
||||
action.spawn = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"];
|
||||
allow-when-locked = true;
|
||||
};
|
||||
"XF86AudioMicMute" = {
|
||||
action.spawn = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"];
|
||||
allow-when-locked = true;
|
||||
};
|
||||
|
||||
# Brightness
|
||||
"XF86MonBrightnessUp" = {
|
||||
action.spawn = ["brightnessctl" "set" "10%+"];
|
||||
allow-when-locked = true;
|
||||
};
|
||||
"XF86MonBrightnessDown" = {
|
||||
action.spawn = ["brightnessctl" "set" "10%-"];
|
||||
allow-when-locked = true;
|
||||
};
|
||||
|
||||
# Scroll bindings
|
||||
"Mod+WheelScrollDown" = {
|
||||
action = focus-workspace-down;
|
||||
cooldown-ms = 150;
|
||||
};
|
||||
"Mod+WheelScrollUp" = {
|
||||
action = focus-workspace-up;
|
||||
cooldown-ms = 150;
|
||||
};
|
||||
"Mod+WheelScrollRight".action = focus-column-right;
|
||||
"Mod+WheelScrollLeft".action = focus-column-left;
|
||||
"Mod+TouchpadScrollDown" = {
|
||||
action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02+"];
|
||||
cooldown-ms = 150;
|
||||
};
|
||||
"Mod+TouchpadScrollUp" = {
|
||||
action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02-"];
|
||||
cooldown-ms = 150;
|
||||
};
|
||||
|
||||
# Custom applications
|
||||
"Mod+W".action.spawn = "${browser}";
|
||||
"Mod+E".action.spawn = "thunar";
|
||||
"Mod+Ctrl+Escape".action.spawn = "btop";
|
||||
|
||||
# Advanced
|
||||
"Mod+H".action = consume-window-into-column;
|
||||
"Mod+K".action = expel-window-from-column;
|
||||
"Mod+Ctrl+H".action = consume-or-expel-window-left;
|
||||
"Mod+Ctrl+L".action = consume-or-expel-window-right;
|
||||
"Mod+Shift+T".action = do-screen-transition;
|
||||
"Mod+O".action = toggle-window-rule-opacity;
|
||||
"Mod+Shift+Ctrl+T".action = toggle-debug-tint;
|
||||
"Mod+Escape" = {
|
||||
action = toggle-keyboard-shortcuts-inhibit;
|
||||
allow-inhibiting = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
8
modules/home/niri/default.nix
Normal file
8
modules/home/niri/default.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{ host, ... }:
|
||||
{
|
||||
imports = [
|
||||
./niri.nix
|
||||
./binds.nix
|
||||
./windowrules.nix
|
||||
];
|
||||
}
|
||||
117
modules/home/niri/niri.nix
Normal file
117
modules/home/niri/niri.nix
Normal file
@@ -0,0 +1,117 @@
|
||||
{ host, config, pkgs, inputs, ... }:
|
||||
let
|
||||
vars = import ../../../hosts/${host}/variables.nix;
|
||||
extraMonitorSettings = vars.extraMonitorSettings;
|
||||
keyboardLayout = vars.keyboardLayout or "us";
|
||||
keyboardVariant = vars.keyboardVariant or "";
|
||||
stylixImage = vars.stylixImage;
|
||||
in
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
swww
|
||||
grim
|
||||
slurp
|
||||
wl-clipboard
|
||||
swappy
|
||||
xwayland-satellite
|
||||
];
|
||||
|
||||
home.file = {
|
||||
"Pictures/Wallpapers" = {
|
||||
source = ../../../wallpapers;
|
||||
recursive = true;
|
||||
};
|
||||
".face.icon".source = ../face.jpg;
|
||||
".config/face.jpg".source = ../face.jpg;
|
||||
};
|
||||
|
||||
programs.niri = {
|
||||
settings = {
|
||||
input = {
|
||||
keyboard = {
|
||||
xkb = {
|
||||
layout = "${keyboardLayout}";
|
||||
variant = "${keyboardVariant}";
|
||||
options = "grp:alt_caps_toggle,caps:super";
|
||||
};
|
||||
repeat-delay = 300;
|
||||
repeat-rate = 50;
|
||||
};
|
||||
|
||||
touchpad = {
|
||||
tap = true;
|
||||
natural-scroll = true;
|
||||
dwt = true;
|
||||
scroll-factor = 0.8;
|
||||
};
|
||||
|
||||
mouse = {
|
||||
accel-speed = 0.0;
|
||||
};
|
||||
};
|
||||
|
||||
layout = {
|
||||
gaps = 8;
|
||||
center-focused-column = "never";
|
||||
|
||||
border = {
|
||||
enable = true;
|
||||
width = 2;
|
||||
active = {
|
||||
color = "#${config.lib.stylix.colors.base08}";
|
||||
};
|
||||
inactive = {
|
||||
color = "#${config.lib.stylix.colors.base01}";
|
||||
};
|
||||
};
|
||||
|
||||
focus-ring = {
|
||||
enable = false;
|
||||
};
|
||||
};
|
||||
|
||||
spawn-at-startup = [
|
||||
{ command = [ "xwayland-satellite" ":1" ]; }
|
||||
{ command = [ "swww-daemon" ]; }
|
||||
{ command = [ "waybar" ]; }
|
||||
{ command = [ "swaync" ]; }
|
||||
{ command = [ "swww" "img" "${stylixImage}" ]; }
|
||||
{ command = [ "swayidle" "-w" "before-sleep" "swaylock" ]; }
|
||||
];
|
||||
|
||||
prefer-no-csd = true;
|
||||
|
||||
screenshot-path = "~/Pictures/Screenshots/Screenshot-%Y-%m-%d-%H-%M-%S.png";
|
||||
|
||||
environment = {
|
||||
DISPLAY = ":1";
|
||||
NIXOS_OZONE_WL = "1";
|
||||
MOZ_ENABLE_WAYLAND = "1";
|
||||
MOZ_WEBRENDER = "1";
|
||||
XDG_SESSION_TYPE = "wayland";
|
||||
WLR_NO_HARDWARE_CURSORS = "1";
|
||||
QT_QPA_PLATFORM = "wayland";
|
||||
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
|
||||
GDK_BACKEND = "wayland,x11";
|
||||
CLUTTER_BACKEND = "wayland";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.targets.niri-shutdown = {
|
||||
Unit = {
|
||||
Description = "Shutdown running niri user services";
|
||||
DefaultDependencies = "no";
|
||||
StopWhenUnneeded = true;
|
||||
|
||||
Conflicts = [
|
||||
"graphical-session.target"
|
||||
"graphical-session-pre.target"
|
||||
];
|
||||
After = [
|
||||
"graphical-session.target"
|
||||
"graphical-session-pre.target"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
55
modules/home/niri/windowrules.nix
Normal file
55
modules/home/niri/windowrules.nix
Normal file
@@ -0,0 +1,55 @@
|
||||
{ ... }:
|
||||
{
|
||||
programs.niri.settings = {
|
||||
window-rules = [
|
||||
{
|
||||
matches = [
|
||||
{ app-id = "^org.kde.polkit-kde-authentication-agent-1$"; }
|
||||
];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{ app-id = "^pavucontrol$"; }
|
||||
];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{ app-id = "^blueman-manager$"; }
|
||||
];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{ app-id = "^nm-connection-editor$"; }
|
||||
];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{ title = "^Picture-in-Picture$"; }
|
||||
];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{ app-id = "^thunar$"; title = "^File Operation Progress$"; }
|
||||
];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{ app-id = "^firefox$"; title = "^Picture-in-Picture$"; }
|
||||
];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{ app-id = "^rofi$"; }
|
||||
];
|
||||
open-floating = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user