init
This commit is contained in:
commit
0df1237eb2
19 changed files with 1921 additions and 0 deletions
144
modules/niri/binds.nix
Normal file
144
modules/niri/binds.nix
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
lib = pkgs.lib;
|
||||
qs = "${pkgs.quickshell}/bin/qs";
|
||||
|
||||
# Niri built-in actions
|
||||
inherit (config.lib.niri.actions)
|
||||
spawn
|
||||
close-window
|
||||
maximize-column
|
||||
screenshot-window
|
||||
screenshot
|
||||
focus-column-left
|
||||
focus-column-right
|
||||
focus-workspace-up
|
||||
focus-workspace-down
|
||||
;
|
||||
|
||||
# Helper to call QuickShell
|
||||
qsCall =
|
||||
args:
|
||||
spawn (
|
||||
[
|
||||
qs
|
||||
"-c"
|
||||
"DankMaterialShell"
|
||||
"ipc"
|
||||
"call"
|
||||
]
|
||||
++ args
|
||||
);
|
||||
|
||||
# Generate workspace focus binds (Mod+1 to Mod+9)
|
||||
wsBinds = builtins.listToAttrs (
|
||||
builtins.genList (i: {
|
||||
name = "Mod+${toString (i + 1)}";
|
||||
value.action.focus-workspace = i + 1;
|
||||
}) 9
|
||||
);
|
||||
|
||||
in
|
||||
{
|
||||
programs.niri.settings.binds = lib.mkMerge [
|
||||
# --- Static Keybindings ---
|
||||
{
|
||||
# --- Media Keys ---
|
||||
|
||||
# --- Audio / Brightness ---
|
||||
"XF86AudioMute" = {
|
||||
allow-when-locked = true;
|
||||
action = qsCall [
|
||||
"audio"
|
||||
"mute"
|
||||
];
|
||||
};
|
||||
"XF86AudioMicMute" = {
|
||||
allow-when-locked = true;
|
||||
action = qsCall [
|
||||
"audio"
|
||||
"micmute"
|
||||
];
|
||||
};
|
||||
"XF86AudioRaiseVolume" = {
|
||||
allow-when-locked = true;
|
||||
action = qsCall [
|
||||
"audio"
|
||||
"increment"
|
||||
"5"
|
||||
];
|
||||
};
|
||||
"XF86AudioLowerVolume" = {
|
||||
allow-when-locked = true;
|
||||
action = qsCall [
|
||||
"audio"
|
||||
"decrement"
|
||||
"5"
|
||||
];
|
||||
};
|
||||
"XF86MonBrightnessUp" = {
|
||||
allow-when-locked = true;
|
||||
action = qsCall [
|
||||
"brightness"
|
||||
"increment"
|
||||
"5"
|
||||
"amdgpu_bl1"
|
||||
];
|
||||
};
|
||||
"XF86MonBrightnessDown" = {
|
||||
allow-when-locked = true;
|
||||
action = qsCall [
|
||||
"brightness"
|
||||
"decrement"
|
||||
"5"
|
||||
"amdgpu_bl1"
|
||||
];
|
||||
};
|
||||
|
||||
# --- System Actions ---
|
||||
"Ctrl+Alt+L".action = qsCall [
|
||||
"lock"
|
||||
"lock"
|
||||
];
|
||||
"Mod+V".action = qsCall [
|
||||
"clipboard"
|
||||
"toggle"
|
||||
];
|
||||
"Mod+U".action = qsCall [
|
||||
"settings"
|
||||
"toggle"
|
||||
];
|
||||
"Mod+M".action = qsCall [
|
||||
"processlist"
|
||||
"toggle"
|
||||
];
|
||||
|
||||
# --- Screenshots ---
|
||||
"Print".action.screenshot-screen = {
|
||||
write-to-disk = true;
|
||||
};
|
||||
"Mod+Shift+Alt+S".action = screenshot-window;
|
||||
"Mod+Shift+S".action.screenshot = {
|
||||
show-pointer = false;
|
||||
};
|
||||
|
||||
# --- Launchers ---
|
||||
"Mod+D".action = spawn (lib.getExe pkgs.fuzzel);
|
||||
"Mod+Return".action = spawn (lib.getExe pkgs.alacritty);
|
||||
|
||||
# --- Window / Layout ---
|
||||
"Mod+W".action = close-window;
|
||||
"Mod+F".action = maximize-column;
|
||||
|
||||
# --- Navigation ---
|
||||
"Mod+Left".action = focus-column-left;
|
||||
"Mod+Right".action = focus-column-right;
|
||||
"Mod+Down".action = focus-workspace-down;
|
||||
"Mod+Up".action = focus-workspace-up;
|
||||
}
|
||||
|
||||
# --- Dynamic Workspace Binds ---
|
||||
wsBinds
|
||||
];
|
||||
}
|
||||
8
modules/niri/default.nix
Normal file
8
modules/niri/default.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{ inputs, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./settings.nix
|
||||
./binds.nix
|
||||
./rules.nix
|
||||
];
|
||||
}
|
||||
249
modules/niri/rules.nix
Normal file
249
modules/niri/rules.nix
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
_:
|
||||
let
|
||||
windowRules = [
|
||||
{
|
||||
geometry-corner-radius =
|
||||
let
|
||||
radius = 12.0;
|
||||
in
|
||||
{
|
||||
bottom-left = radius;
|
||||
bottom-right = radius;
|
||||
top-left = radius;
|
||||
top-right = radius;
|
||||
};
|
||||
clip-to-geometry = true;
|
||||
draw-border-with-background = false;
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{ is-floating = true; }
|
||||
];
|
||||
shadow.enable = true;
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{
|
||||
is-window-cast-target = true;
|
||||
}
|
||||
];
|
||||
focus-ring = {
|
||||
active.color = "#f38ba8";
|
||||
inactive.color = "#7d0d2d";
|
||||
};
|
||||
border = {
|
||||
inactive.color = "#7d0d2d";
|
||||
};
|
||||
shadow = {
|
||||
color = "#7d0d2d70";
|
||||
};
|
||||
tab-indicator = {
|
||||
active.color = "#f38ba8";
|
||||
inactive.color = "#7d0d2d";
|
||||
};
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "org.telegram.desktop"; }];
|
||||
block-out-from = "screencast";
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "app.drey.PaperPlane"; }];
|
||||
block-out-from = "screencast";
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{ app-id = "zen"; }
|
||||
{ app-id = "firefox"; }
|
||||
{ app-id = "chromium-browser"; }
|
||||
{ app-id = "xdg-desktop-portal-gtk"; }
|
||||
];
|
||||
scroll-factor = 0.5;
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{ app-id = "zen"; }
|
||||
{ app-id = "firefox"; }
|
||||
{ app-id = "chromium-browser"; }
|
||||
{ app-id = "edge"; }
|
||||
];
|
||||
open-maximized = true;
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{
|
||||
app-id = "firefox";
|
||||
title = "Picture-in-Picture";
|
||||
}
|
||||
];
|
||||
open-floating = true;
|
||||
default-floating-position = {
|
||||
x = 32;
|
||||
y = 32;
|
||||
relative-to = "bottom-right";
|
||||
};
|
||||
default-column-width = {
|
||||
fixed = 480;
|
||||
};
|
||||
default-window-height = {
|
||||
fixed = 270;
|
||||
};
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{
|
||||
app-id = "zen";
|
||||
title = "Picture-in-Picture";
|
||||
}
|
||||
];
|
||||
open-floating = true;
|
||||
default-floating-position = {
|
||||
x = 32;
|
||||
y = 32;
|
||||
relative-to = "bottom-right";
|
||||
};
|
||||
default-column-width = {
|
||||
fixed = 480;
|
||||
};
|
||||
default-window-height = {
|
||||
fixed = 270;
|
||||
};
|
||||
}
|
||||
{
|
||||
matches = [{ title = "Picture in picture"; }];
|
||||
open-floating = true;
|
||||
default-floating-position = {
|
||||
x = 32;
|
||||
y = 32;
|
||||
relative-to = "bottom-right";
|
||||
};
|
||||
}
|
||||
{
|
||||
matches = [{ title = "Discord Popout"; }];
|
||||
open-floating = true;
|
||||
default-floating-position = {
|
||||
x = 32;
|
||||
y = 32;
|
||||
relative-to = "bottom-right";
|
||||
};
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "pavucontrol"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "pavucontrol-qt"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "com.saivert.pwvucontrol"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "io.github.fsobolev.Cavalier"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "dialog"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "popup"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "task_dialog"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "gcr-prompter"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "file-roller"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "org.gnome.FileRoller"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "nm-connection-editor"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "blueman-manager"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "xdg-desktop-portal-gtk"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "org.kde.polkit-kde-authentication-agent-1"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ app-id = "pinentry"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ title = "Progress"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ title = "File Operations"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ title = "Copying"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ title = "Moving"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ title = "Properties"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ title = "Downloads"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ title = "file progress"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ title = "Confirm"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ title = "Authentication Required"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ title = "Notice"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ title = "Warning"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
matches = [{ title = "Error"; }];
|
||||
open-floating = true;
|
||||
}
|
||||
];
|
||||
in
|
||||
{
|
||||
programs.niri.settings = {
|
||||
window-rules = windowRules;
|
||||
layer-rules = [
|
||||
{
|
||||
matches = [{ namespace = "^swww$"; }];
|
||||
place-within-backdrop = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
135
modules/niri/settings.nix
Normal file
135
modules/niri/settings.nix
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
makeCommand = command: {
|
||||
command = [ command ];
|
||||
};
|
||||
qs = "${pkgs.quickshell}/bin/qs";
|
||||
wl-paste = "${pkgs.wl-clipboard}/bin/wl-paste";
|
||||
in
|
||||
{
|
||||
programs.niri.settings = {
|
||||
environment = {
|
||||
CLUTTER_BACKEND = "wayland";
|
||||
DISPLAY = ":0";
|
||||
GDK_BACKEND = "wayland,x11";
|
||||
MOZ_ENABLE_WAYLAND = "1";
|
||||
NIXOS_OZONE_WL = "1";
|
||||
QT_QPA_PLATFORM = "wayland;xcb";
|
||||
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
|
||||
SDL_VIDEODRIVER = "wayland";
|
||||
};
|
||||
spawn-at-startup = [
|
||||
(makeCommand "${lib.getExe pkgs.hyprlock}")
|
||||
(makeCommand "${pkgs.swww}/bin/swww-daemon")
|
||||
{
|
||||
command = [
|
||||
"${wl-paste}"
|
||||
"--watch"
|
||||
"cliphist"
|
||||
"store"
|
||||
];
|
||||
}
|
||||
{
|
||||
command = [
|
||||
"${wl-paste}"
|
||||
"--type text"
|
||||
"--watch"
|
||||
"cliphist"
|
||||
"store"
|
||||
];
|
||||
}
|
||||
{
|
||||
command = [
|
||||
"${qs}"
|
||||
"-c"
|
||||
"DankMaterialShell"
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
input = {
|
||||
touchpad = {
|
||||
click-method = "button-areas";
|
||||
dwt = true;
|
||||
dwtp = true;
|
||||
natural-scroll = true;
|
||||
scroll-method = "two-finger";
|
||||
tap = true;
|
||||
tap-button-map = "left-right-middle";
|
||||
middle-emulation = true;
|
||||
accel-profile = "adaptive";
|
||||
};
|
||||
focus-follows-mouse = {
|
||||
enable = true;
|
||||
max-scroll-amount = "90%";
|
||||
};
|
||||
warp-mouse-to-focus.enable = true;
|
||||
workspace-auto-back-and-forth = true;
|
||||
};
|
||||
|
||||
outputs = {
|
||||
"eDP-1" = {
|
||||
scale = 1.0;
|
||||
position = {
|
||||
x = 0;
|
||||
y = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
overview = {
|
||||
workspace-shadow.enable = false;
|
||||
backdrop-color = "transparent";
|
||||
};
|
||||
gestures = {
|
||||
hot-corners.enable = true;
|
||||
};
|
||||
layout = {
|
||||
focus-ring.enable = false;
|
||||
border = {
|
||||
enable = true;
|
||||
width = 2;
|
||||
#active.color = "#${base0D}";
|
||||
#inactive.color = "#${base07}";
|
||||
};
|
||||
shadow = {
|
||||
enable = false;
|
||||
};
|
||||
preset-column-widths = [
|
||||
{ proportion = 0.25; }
|
||||
{ proportion = 0.5; }
|
||||
{ proportion = 0.75; }
|
||||
{ proportion = 1.0; }
|
||||
];
|
||||
default-column-width = {
|
||||
proportion = 0.5;
|
||||
};
|
||||
|
||||
gaps = 6;
|
||||
struts = {
|
||||
left = 0;
|
||||
right = 0;
|
||||
top = 0;
|
||||
bottom = 0;
|
||||
};
|
||||
|
||||
tab-indicator = {
|
||||
hide-when-single-tab = true;
|
||||
place-within-column = true;
|
||||
position = "left";
|
||||
corner-radius = 20.0;
|
||||
gap = -12.0;
|
||||
gaps-between-tabs = 10.0;
|
||||
width = 4.0;
|
||||
length.total-proportion = 0.1;
|
||||
};
|
||||
};
|
||||
|
||||
prefer-no-csd = true;
|
||||
hotkey-overlay.skip-at-startup = true;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue