1
1
Fork 0

niri: modify config

Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
Myned 2024-12-31 12:44:17 -06:00
parent 6d3e618ed5
commit baca73c33e
Signed by: Myned
GPG key ID: C7224454F7881A34
6 changed files with 447 additions and 437 deletions

View file

@ -5,7 +5,10 @@
... ...
}: }:
with lib; let with lib; let
audio = "~/.local/bin/audio"; cfg = config.custom.desktops.niri.binds;
hm = config.home-manager.users.${config.custom.username};
audio = config.home-manager.users.${config.custom.username}.home.file.".local/bin/audio".source;
bash = "${pkgs.bash}/bin/bash"; bash = "${pkgs.bash}/bin/bash";
cat = "${pkgs.coreutils}/bin/cat"; cat = "${pkgs.coreutils}/bin/cat";
codium = "${config.home-manager.users.${config.custom.username}.programs.vscode.package}/bin/codium"; codium = "${config.home-manager.users.${config.custom.username}.programs.vscode.package}/bin/codium";
@ -32,150 +35,150 @@ with lib; let
waydroid = "${pkgs.waydroid}/bin/waydroid"; waydroid = "${pkgs.waydroid}/bin/waydroid";
_1password = "${config.programs._1password-gui.package}/bin/1password"; _1password = "${config.programs._1password-gui.package}/bin/1password";
youtube-music = "${pkgs.youtube-music}/bin/youtube-music"; youtube-music = "${pkgs.youtube-music}/bin/youtube-music";
cfg = config.custom.desktops.niri.binds;
in { in {
options.custom.desktops.niri.binds = { options.custom.desktops.niri.binds = {
enable = mkOption {default = false;}; enable = mkOption {default = false;};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.${config.custom.username} = { home-manager.sharedModules = [
# https://github.com/YaLTeR/niri/wiki/Configuration:-Key-Bindings {
#?? Mod = Super/Win, Alt when nested; Mod5 = AltGr # https://github.com/YaLTeR/niri/wiki/Configuration:-Key-Bindings
#?? wev #?? Mod = Super/Win, Alt when nested; Mod5 = AltGr
programs.niri.settings.binds = let #?? wev
# Swap modifiers and key for alphabetical sorting programs.niri.settings.binds = let
#?? (key "KEY" "MODIFIERS" (ACTION "ARGUMENT")) # Swap modifiers and key for alphabetical sorting
key = key: modifiers: action: { #?? (key "KEY" "MODIFIERS" (ACTION "ARGUMENT"))
name = "${ key = key: modifiers: action: {
if (isString modifiers) name = "${
then "${modifiers}+" if (isString modifiers)
else "" then "${modifiers}+"
}${key}"; else ""
value = {inherit action;}; }${key}";
}; value = {inherit action;};
};
# Launch VM # Launch VM
vm = ''${remote} --vm --client xfreerdp --username Myned --password "$(${cat} ${config.age.secrets."desktop/vm/myndows.pass".path})" ${ vm = ''${remote} --vm --client xfreerdp --username Myned --password "$(${cat} ${config.age.secrets."desktop/vm/myndows.pass".path})" ${
if config.custom.hidpi if config.custom.hidpi
then "--scale 140" then "--scale 140"
else "" else ""
} myndows''; } myndows'';
in in
listToAttrs (with config.home-manager.users.${config.custom.username}.lib.niri.actions; [ listToAttrs (with hm.lib.niri.actions; [
(key "0" "Mod" (spawn [swayosd-client "--output-volume" "mute-toggle"])) (key "0" "Mod" (spawn [swayosd-client "--output-volume" "mute-toggle"]))
(key "1" "Ctrl+Alt" (spawn ["lifx" "state" "--brightness" "0.01"])) (key "1" "Ctrl+Alt" (spawn ["lifx" "state" "--brightness" "0.01"]))
(key "1" "Mod" (focus-workspace "1")) (key "1" "Mod" (focus-workspace "1"))
(key "1" "Mod+Alt" (spawn ["lifx" "state" "--kelvin" "1500"])) (key "1" "Mod+Alt" (spawn ["lifx" "state" "--kelvin" "1500"]))
(key "1" "Mod+Shift" (move-column-to-workspace "1")) (key "1" "Mod+Shift" (move-column-to-workspace "1"))
(key "2" "Ctrl+Alt" (spawn ["lifx" "state" "--brightness" "0.25"])) (key "2" "Ctrl+Alt" (spawn ["lifx" "state" "--brightness" "0.25"]))
(key "2" "Mod" (focus-workspace "2")) (key "2" "Mod" (focus-workspace "2"))
(key "2" "Mod+Alt" (spawn ["lifx" "state" "--kelvin" "2500"])) (key "2" "Mod+Alt" (spawn ["lifx" "state" "--kelvin" "2500"]))
(key "2" "Mod+Shift" (move-column-to-workspace "2")) (key "2" "Mod+Shift" (move-column-to-workspace "2"))
(key "3" "Ctrl+Alt" (spawn ["lifx" "state" "--brightness" "0.50"])) (key "3" "Ctrl+Alt" (spawn ["lifx" "state" "--brightness" "0.50"]))
(key "3" "Mod" (focus-workspace "3")) (key "3" "Mod" (focus-workspace "3"))
(key "3" "Mod+Alt" (spawn ["lifx" "state" "--kelvin" "3000"])) (key "3" "Mod+Alt" (spawn ["lifx" "state" "--kelvin" "3000"]))
(key "3" "Mod+Shift" (move-column-to-workspace "3")) (key "3" "Mod+Shift" (move-column-to-workspace "3"))
(key "4" "Ctrl+Alt" (spawn ["lifx" "state" "--brightness" "0.75"])) (key "4" "Ctrl+Alt" (spawn ["lifx" "state" "--brightness" "0.75"]))
(key "4" "Mod" (focus-workspace "4")) (key "4" "Mod" (focus-workspace "4"))
(key "4" "Mod+Alt" (spawn ["lifx" "state" "--kelvin" "4000"])) (key "4" "Mod+Alt" (spawn ["lifx" "state" "--kelvin" "4000"]))
(key "4" "Mod+Shift" (move-column-to-workspace "4")) (key "4" "Mod+Shift" (move-column-to-workspace "4"))
(key "5" "Ctrl+Alt" (spawn ["lifx" "state" "--brightness" "1.00"])) (key "5" "Ctrl+Alt" (spawn ["lifx" "state" "--brightness" "1.00"]))
(key "5" "Mod" (focus-workspace "5")) (key "5" "Mod" (focus-workspace "5"))
(key "5" "Mod+Alt" (spawn ["lifx" "state" "--kelvin" "5000"])) (key "5" "Mod+Alt" (spawn ["lifx" "state" "--kelvin" "5000"]))
(key "5" "Mod+Shift" (move-column-to-workspace "5")) (key "5" "Mod+Shift" (move-column-to-workspace "5"))
(key "6" "Mod" (focus-workspace "6")) (key "6" "Mod" (focus-workspace "6"))
(key "6" "Mod+Shift" (move-column-to-workspace "6")) (key "6" "Mod+Shift" (move-column-to-workspace "6"))
(key "7" "Mod" (focus-workspace "7")) (key "7" "Mod" (focus-workspace "7"))
(key "7" "Mod+Shift" (move-column-to-workspace "7")) (key "7" "Mod+Shift" (move-column-to-workspace "7"))
(key "8" "Mod" (focus-workspace "8")) (key "8" "Mod" (focus-workspace "8"))
(key "8" "Mod+Shift" (move-column-to-workspace "8")) (key "8" "Mod+Shift" (move-column-to-workspace "8"))
(key "9" "Mod" (spawn audio)) (key "9" "Mod" (spawn audio))
(key "A" "Ctrl+Alt" (spawn [waydroid "session" "stop"])) (key "A" "Ctrl+Alt" (spawn [waydroid "session" "stop"]))
(key "A" "Mod" focus-column-or-monitor-left) (key "A" "Mod" focus-column-or-monitor-left)
(key "A" "Mod+Ctrl" consume-or-expel-window-left) (key "A" "Mod+Ctrl" consume-or-expel-window-left)
(key "A" "Mod+Shift" move-column-left-or-to-monitor-left) (key "A" "Mod+Shift" move-column-left-or-to-monitor-left)
(key "Apostrophe" "Mod" screenshot) (key "Apostrophe" "Mod" screenshot)
(key "Apostrophe" "Mod+Ctrl+Shift" screenshot-screen) (key "Apostrophe" "Mod+Ctrl+Shift" screenshot-screen)
(key "Apostrophe" "Mod+Shift" screenshot-window) (key "Apostrophe" "Mod+Shift" screenshot-window)
(key "B" "Ctrl+Alt" (spawn [pkill config.custom.browser.command])) (key "B" "Ctrl+Alt" (spawn [pkill config.custom.browser.command]))
(key "B" "Mod" (spawn config.custom.browser.command)) (key "B" "Mod" (spawn config.custom.browser.command))
(key "Backslash" "Mod" (spawn inhibit)) (key "Backslash" "Mod" (spawn inhibit))
(key "Backslash" "Mod+Shift" (spawn power)) (key "Backslash" "Mod+Shift" (spawn power))
(key "Bracketleft" "Mod" (switch-layout "prev")) (key "Bracketleft" "Mod" (switch-layout "prev"))
(key "Bracketright" "Mod" (switch-layout "next")) (key "Bracketright" "Mod" (switch-layout "next"))
(key "C" "Mod" (spawn [walker "--modules" "clipboard"])) (key "C" "Mod" (spawn [walker "--modules" "clipboard"]))
(key "C" "Mod+Ctrl" (spawn [bash "-c" "${rm} ~/.cache/walker/clipboard.gob && ${notify-send} menu 'Clipboard cleared' --urgency low"])) (key "C" "Mod+Ctrl" (spawn [bash "-c" "${rm} ~/.cache/walker/clipboard.gob && ${notify-send} menu 'Clipboard cleared' --urgency low"]))
(key "Delete" "Ctrl+Alt" (spawn [loginctl "terminate-user" config.custom.username])) (key "Delete" "Ctrl+Alt" (spawn [loginctl "terminate-user" config.custom.username]))
(key "Delete" "Mod" (spawn [playerctl] "play-pause")) (key "Delete" "Mod" (spawn [playerctl] "play-pause"))
(key "Down" "Mod" (spawn [swayosd-client "--brightness" "lower"])) (key "Down" "Mod" (spawn [swayosd-client "--brightness" "lower"]))
(key "E" "Ctrl+Alt" (spawn [pkill "codium"])) (key "E" "Ctrl+Alt" (spawn [pkill "codium"]))
(key "E" "Mod" (spawn codium)) (key "E" "Mod" (spawn codium))
(key "Equal" "Mod" (spawn [swayosd-client "--output-volume" "raise"])) (key "Equal" "Mod" (spawn [swayosd-client "--output-volume" "raise"]))
(key "Escape" "Mod" toggle-window-floating) (key "Escape" "Mod" toggle-window-floating)
(key "Escape" "Mod+Alt" (spawn ["lifx" "state" "--color" "red"])) (key "Escape" "Mod+Alt" (spawn ["lifx" "state" "--color" "red"]))
(key "F" "Mod" (spawn [nautilus "--new-window"])) (key "F" "Mod" (spawn [nautilus "--new-window"]))
(key "G" "Ctrl+Alt" (spawn [pkill "steam"])) (key "G" "Ctrl+Alt" (spawn [pkill "steam"]))
(key "G" "Mod" (spawn steam)) (key "G" "Mod" (spawn steam))
(key "K" "Ctrl+Alt" (spawn [pkill "obsidian"])) (key "K" "Ctrl+Alt" (spawn [pkill "obsidian"]))
(key "K" "Mod" (spawn obsidian)) (key "K" "Mod" (spawn obsidian))
(key "L" "Mod" (spawn [bash "-c" "${hyprlock} --immediate & ${niri} msg action power-off-monitors"])) (key "L" "Mod" (spawn [bash "-c" "${hyprlock} --immediate & ${niri} msg action power-off-monitors"]))
(key "L" "Mod+Shift" suspend) (key "L" "Mod+Shift" suspend)
(key "Left" "Mod" (spawn [playerctl "previous"])) (key "Left" "Mod" (spawn [playerctl "previous"]))
(key "M" "Ctrl+Alt" (spawn [pkill "youtube-music"])) (key "M" "Ctrl+Alt" (spawn [pkill "youtube-music"]))
(key "M" "Mod" (spawn youtube-music)) (key "M" "Mod" (spawn youtube-music))
(key "Minus" "Mod" (spawn [swayosd-client "--output-volume" "lower"])) (key "Minus" "Mod" (spawn [swayosd-client "--output-volume" "lower"]))
(key "O" "Mod" (spawn [loupe "/tmp/wallpaper.png"])) (key "O" "Mod" (spawn [loupe "/tmp/wallpaper.png"]))
(key "P" "Ctrl+Alt" (spawn [pkill "1password"])) (key "P" "Ctrl+Alt" (spawn [pkill "1password"]))
(key "P" "Mod" (spawn _1password)) (key "P" "Mod" (spawn _1password))
(key "Q" "Mod" close-window) (key "Q" "Mod" close-window)
(key "R" "Mod" focus-window-or-workspace-down) (key "R" "Mod" focus-window-or-workspace-down)
(key "R" "Mod+Shift" move-window-down-or-to-workspace-down) (key "R" "Mod+Shift" move-window-down-or-to-workspace-down)
(key "Return" "Mod" maximize-column) (key "Return" "Mod" maximize-column)
(key "Return" "Mod+Ctrl" center-column) (key "Return" "Mod+Ctrl" center-column)
(key "Return" "Mod+Shift" fullscreen-window) (key "Return" "Mod+Shift" fullscreen-window)
(key "Right" "Mod" (spawn [playerctl "next"])) (key "Right" "Mod" (spawn [playerctl "next"]))
(key "S" "Mod" focus-column-or-monitor-right) (key "S" "Mod" focus-column-or-monitor-right)
(key "S" "Mod+Ctrl" consume-or-expel-window-right) (key "S" "Mod+Ctrl" consume-or-expel-window-right)
(key "S" "Mod+Shift" move-column-right-or-to-monitor-right) (key "S" "Mod+Shift" move-column-right-or-to-monitor-right)
(key "Semicolon" "Mod" (spawn [hyprpicker "--autocopy"])) (key "Semicolon" "Mod" (spawn [hyprpicker "--autocopy"]))
(key "Semicolon" "Mod+Shift" (spawn [hyprpicker "--autocopy --format rgb"])) (key "Semicolon" "Mod+Shift" (spawn [hyprpicker "--autocopy --format rgb"]))
(key "Slash" "Mod+Shift" show-hotkey-overlay) (key "Slash" "Mod+Shift" show-hotkey-overlay)
(key "Space" "Ctrl+Alt" (spawn ["lifx" "toggle"])) (key "Space" "Ctrl+Alt" (spawn ["lifx" "toggle"]))
(key "Space" "Ctrl+Alt" (spawn ["lifx" "toggle"])) (key "Space" "Ctrl+Alt" (spawn ["lifx" "toggle"]))
(key "T" "Ctrl+Alt" (spawn [pkill "kitty"])) (key "T" "Ctrl+Alt" (spawn [pkill "kitty"]))
(key "T" "Mod" (spawn kitty)) (key "T" "Mod" (spawn kitty))
(key "Tab" "Mod" switch-focus-between-floating-and-tiling) (key "Tab" "Mod" switch-focus-between-floating-and-tiling)
(key "Up" "Mod" (spawn [swayosd-client "--brightness" "raise"])) (key "Up" "Mod" (spawn [swayosd-client "--brightness" "raise"]))
(key "V" "Mod" (spawn virt-manager)) (key "V" "Mod" (spawn virt-manager))
(key "V" "Mod+Ctrl" (spawn vm)) (key "V" "Mod+Ctrl" (spawn vm))
(key "W" "Mod" focus-window-or-workspace-up) (key "W" "Mod" focus-window-or-workspace-up)
(key "W" "Mod+Shift" move-window-up-or-to-workspace-up) (key "W" "Mod+Shift" move-window-up-or-to-workspace-up)
(key "X" "Mod" switch-preset-column-width) (key "X" "Mod" switch-preset-column-width)
(key "Z" "Mod" switch-preset-window-height) (key "Z" "Mod" switch-preset-window-height)
# BUG: Release binds execute with all binds involving that modifier # BUG: Release binds execute with all binds involving that modifier
# https://github.com/YaLTeR/niri/issues/605 # https://github.com/YaLTeR/niri/issues/605
# TODO: Uncomment when fixed # TODO: Uncomment when fixed
#// (key "Shift_L" "Mod" focus-workspace-previous) #// (key "Shift_L" "Mod" focus-workspace-previous)
# TODO: Use "Super_L" when fixed # TODO: Use "Super_L" when fixed
(key "Space" "Mod" (spawn walker)) (key "Space" "Mod" (spawn walker))
(key "Space" "Mod+Ctrl+Shift" (spawn networkmanager_dmenu)) (key "Space" "Mod+Ctrl+Shift" (spawn networkmanager_dmenu))
(key "Space" "Mod+Shift" (spawn [walker "--modules" "search"])) (key "Space" "Mod+Shift" (spawn [walker "--modules" "search"]))
# Media keys # Media keys
# https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h # https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h
(key "XF86AudioMute" null (spawn [swayosd-client "--output-volume" "mute-toggle"])) # F1 (key "XF86AudioMute" null (spawn [swayosd-client "--output-volume" "mute-toggle"])) # F1
(key "XF86AudioLowerVolume" null (spawn [swayosd-client "--output-volume" "lower"])) # F2 (key "XF86AudioLowerVolume" null (spawn [swayosd-client "--output-volume" "lower"])) # F2
(key "XF86AudioRaiseVolume" null (spawn [swayosd-client "--output-volume" "raise"])) # F3 (key "XF86AudioRaiseVolume" null (spawn [swayosd-client "--output-volume" "raise"])) # F3
(key "XF86AudioPrev" null (spawn [playerctl "previous"])) # F4 (key "XF86AudioPrev" null (spawn [playerctl "previous"])) # F4
(key "XF86AudioPlay" null (spawn [playerctl "play-pause"])) # F5 (key "XF86AudioPlay" null (spawn [playerctl "play-pause"])) # F5
(key "XF86AudioNext" null (spawn [playerctl "next"])) # F6 (key "XF86AudioNext" null (spawn [playerctl "next"])) # F6
(key "XF86MonBrightnessDown" null (spawn [swayosd-client "--brightness" "lower"])) # F7 (key "XF86MonBrightnessDown" null (spawn [swayosd-client "--brightness" "lower"])) # F7
(key "XF86MonBrightnessUp" null (spawn [swayosd-client "--brightness" "raise"])) # F8 (key "XF86MonBrightnessUp" null (spawn [swayosd-client "--brightness" "raise"])) # F8
(key "XF86AudioMedia" null (spawn [notify-send "test"])) # F12 (key "XF86AudioMedia" null (spawn [notify-send "test"])) # F12
]); ]);
}; }
];
}; };
} }

View file

@ -18,20 +18,25 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
custom.desktops = mkIf config.custom.full { custom = {
niri = { desktops = mkIf config.custom.full {
binds.enable = true; niri = {
input.enable = true; binds.enable = true;
layout.enable = true; input.enable = true;
misc.enable = true; layout.enable = true;
output.enable = true; misc.enable = true;
rules.enable = true; output.enable = true;
rules.enable = true;
};
gnome = {
enable = true;
minimal = true;
};
}; };
gnome = { # Enable rootless Xwayland
enable = true; services.xwayland-satellite.enable = cfg.xwayland;
minimal = true;
};
}; };
# https://github.com/YaLTeR/niri # https://github.com/YaLTeR/niri
@ -45,38 +50,37 @@ in {
nixpkgs.overlays = [inputs.niri-flake.overlays.niri]; nixpkgs.overlays = [inputs.niri-flake.overlays.niri];
#!! Disabled bundled KDE polkit agent #!! Disable bundled KDE polkit agent by default
# https://github.com/sodiboo/niri-flake?tab=readme-ov-file#additional-notes # https://github.com/sodiboo/niri-flake?tab=readme-ov-file#additional-notes
systemd.user.services.niri-flake-polkit.enable = cfg.polkit; systemd.user.services.niri-flake-polkit.enable = cfg.polkit;
# Enable rootless Xwayland home-manager.sharedModules = [
custom.services.xwayland-satellite.enable = cfg.xwayland; {
programs.niri = {
package = config.programs.niri.package;
home-manager.users.${config.custom.username} = { # https://github.com/YaLTeR/niri/wiki/Configuration:-Overview
programs.niri = { # HACK: Prepend validated kdl config not currently implemented in settings module for e.g. custom build
package = config.programs.niri.package; # https://github.com/sodiboo/niri-flake/blob/main/settings.nix
config = with inputs.niri-flake.lib;
(internal.settings-module {config = hm;}).options.programs.niri.config.default
# https://github.com/sodiboo/niri-flake/blob/main/default-config.kdl.nix
++ (with kdl; [
# TODO: Migrate to window-rules when released
# https://github.com/YaLTeR/niri/pull/871
(plain "window-rule" [
(leaf "match" {title = "^Picture.in.[Pp]icture$";})
(leaf "open-floating" true)
])
]);
# https://github.com/YaLTeR/niri/wiki/Configuration:-Overview # https://github.com/YaLTeR/niri/wiki/Configuration:-Debug-Options
# HACK: Prepend validated kdl config not currently implemented in settings module for e.g. custom build # https://github.com/sodiboo/niri-flake/blob/main/docs.md#programsnirisettingsdebug
# https://github.com/sodiboo/niri-flake/blob/main/settings.nix settings.debug = {
config = with inputs.niri-flake.lib; #// disable-direct-scanout = [];
(internal.settings-module {config = hm;}).options.programs.niri.config.default };
# https://github.com/sodiboo/niri-flake/blob/main/default-config.kdl.nix
++ (with kdl; [
# TODO: Migrate to niri.settings when released
# https://github.com/YaLTeR/niri/pull/871
(plain "window-rule" [
(leaf "match" {title = "^Picture.in.[Pp]icture$";})
(leaf "open-floating" true)
])
]);
# https://github.com/YaLTeR/niri/wiki/Configuration:-Debug-Options
# https://github.com/sodiboo/niri-flake/blob/main/docs.md#programsnirisettingsdebug
settings.debug = {
#// disable-direct-scanout = [];
}; };
}; }
}; ];
}; };
} }

View file

@ -11,46 +11,49 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.${config.custom.username} = { home-manager.sharedModules = [
# https://github.com/YaLTeR/niri/wiki/Configuration:-Input {
programs.niri.settings.input = { # https://github.com/YaLTeR/niri/wiki/Configuration:-Input
keyboard = { programs.niri.settings.input = {
repeat-delay = 300; # https://github.com/YaLTeR/niri/wiki/Configuration:-Input#general-settings
repeat-rate = 40; focus-follows-mouse = {
enable = true;
max-scroll-amount = "100%";
};
power-key-handling.enable = false;
workspace-auto-back-and-forth = true;
# https://github.com/YaLTeR/niri/wiki/Configuration:-Input#keyboard
keyboard = {
repeat-delay = 300;
repeat-rate = 40;
};
# BUG: Applies to trackball device, switch to "flat" when per-device configuration is supported
# https://github.com/YaLTeR/niri/issues/371
# https://github.com/YaLTeR/niri/wiki/Configuration:-Input#pointing-devices
mouse = {
accel-profile = "adaptive";
accel-speed = -0.2;
};
touchpad = {
accel-profile = "adaptive";
accel-speed = 0.3;
click-method = "clickfinger"; # Multi-finger click
dwt = true; # Disable while typing
dwtp = true; # Disable while trackpointing
scroll-factor = 0.4;
};
trackball = {
accel-profile = "adaptive";
accel-speed = 0.5;
middle-emulation = true;
};
}; };
}
touchpad = { ];
accel-profile = "adaptive";
accel-speed = 0.3;
click-method = "clickfinger"; # Multi-finger click
dwt = true; # Disable while typing
dwtp = true; # Disable while trackpointing
scroll-factor = 0.4;
};
# BUG: Applies to trackball device, switch to "flat" when per-device configuration is supported
# https://github.com/YaLTeR/niri/issues/371
mouse = {
accel-profile = "adaptive";
accel-speed = -0.2;
};
trackball = {
accel-profile = "adaptive";
accel-speed = 0.5;
middle-emulation = true;
};
power-key-handling.enable = false;
focus-follows-mouse = {
enable = true;
max-scroll-amount = "70%";
};
workspace-auto-back-and-forth = true;
};
};
}; };
} }

View file

@ -11,55 +11,56 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.${config.custom.username} = { home-manager.sharedModules = [
# https://github.com/YaLTeR/niri/wiki/Configuration:-Layout {
programs.niri.settings.layout = let # https://github.com/YaLTeR/niri/wiki/Configuration:-Layout
gap = config.custom.gap / 2; programs.niri.settings.layout = let
in { gap = config.custom.gap / 2;
gaps = gap; in {
#// center-focused-column = mkIf config.custom.ultrawide "always"; always-center-single-column = true;
always-center-single-column = true;
# TODO: Uncomment after next release > v1.10.1 border = {
# https://github.com/YaLTeR/niri/wiki/Configuration:-Layout#empty-workspace-above-first enable = true;
#// empty-workspace-above-first = true; width = config.custom.border;
active.color = "#d33682";
inactive.color = "#00000000";
};
preset-column-widths = [ #/// center-focused-column = mkIf config.custom.ultrawide "always";
{proportion = 0.75;} default-column-width.proportion = 1.0 / 3.0; # 33%
{proportion = 0.5;}
{proportion = 0.25;}
];
default-column-width = {}; # Window-defined # TODO: Uncomment after next release > v1.10.1
# https://github.com/YaLTeR/niri/wiki/Configuration:-Layout#empty-workspace-above-first
#// empty-workspace-above-first = true;
preset-window-heights = [ focus-ring.enable = false;
{proportion = 0.7;} gaps = gap;
{proportion = 0.5;}
{proportion = 0.3;}
{proportion = 1.0;} # Default
];
border = { insert-hint = {
enable = true; enable = true;
width = config.custom.border; display.color = "#d3368280";
active.color = "#d33682"; };
inactive.color = "#00000000";
preset-column-widths = [
{proportion = 1.0 / 3.0;} # 33%, default
{proportion = 2.0 / 3.0;} # 66%
{proportion = 3.0 / 3.0;} # 100%
];
preset-window-heights = [
{proportion = 2.0 / 3.0;} # 66%
{proportion = 1.0 / 3.0;} # 33%
{proportion = 3.0 / 3.0;} # 100%, default
];
struts = {
left = gap;
right = gap;
top = gap;
bottom = gap;
};
}; };
}
focus-ring.enable = false; ];
insert-hint = {
enable = true;
display.color = "#d3368280";
};
struts = {
left = gap;
right = gap;
top = gap;
bottom = gap;
};
};
};
}; };
} }

View file

@ -5,69 +5,63 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.custom.desktops.niri.misc;
hm = config.home-manager.users.${config.custom.username};
_1password = "${config.programs._1password-gui.package}/bin/1password"; _1password = "${config.programs._1password-gui.package}/bin/1password";
audio = config.home-manager.users.${config.custom.username}.home.file.".local/bin/audio".source; audio = config.home-manager.users.${config.custom.username}.home.file.".local/bin/audio".source;
niri = "${config.programs.niri.package}/bin/niri"; niri = "${config.programs.niri.package}/bin/niri";
rm = "${pkgs.coreutils}/bin/rm"; rm = "${pkgs.coreutils}/bin/rm";
sway-audio-idle-inhibit = "${pkgs.sway-audio-idle-inhibit}/bin/sway-audio-idle-inhibit"; sway-audio-idle-inhibit = "${pkgs.sway-audio-idle-inhibit}/bin/sway-audio-idle-inhibit";
wallpaper = "${config.home-manager.users.${config.custom.username}.home.file.".local/bin/wallpaper".source}"; wallpaper = "${config.home-manager.users.${config.custom.username}.home.file.".local/bin/wallpaper".source}";
cfg = config.custom.desktops.niri.misc;
in { in {
options.custom.desktops.niri.misc = { options.custom.desktops.niri.misc = {
enable = mkOption {default = false;}; enable = mkOption {default = false;};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.${config.custom.username} = { home-manager.sharedModules = [
programs.niri.settings = { {
# https://github.com/YaLTeR/niri/wiki/Configuration:-Miscellaneous programs.niri.settings = {
# https://github.com/YaLTeR/niri/wiki/Configuration:-Miscellaneous
cursor = with hm.gtk.cursorTheme; {
# Inherit home-manager GTK settings
inherit size;
theme = name;
# https://github.com/YaLTeR/niri/wiki/Configuration:-Miscellaneous#spawn-at-startup #// hide-after-inactive-ms = 1000 * 15; # Milliseconds
# https://github.com/YaLTeR/niri/wiki/Configuration:-Key-Bindings#actions hide-when-typing = true;
spawn-at-startup = let };
home = config.home-manager.users.${config.custom.username}.home.homeDirectory;
in
[
{command = [_1password "--silent"];} # Launch password manager in background
{command = [audio "--init"];} # Enforce audio profile state
{command = [rm "${home}/.cache/walker/clipboard.gob"];} # Clear clipboard history
{command = [sway-audio-idle-inhibit];} # Inhibit while audio is playing
]
++ optionals config.custom.wallpaper [
{command = [wallpaper];}
];
# HACK: Inherit home-manager environment variables in lieu of upstream fix # HACK: Inherit home-manager environment variables in lieu of upstream fix
# https://github.com/nix-community/home-manager/issues/2659 # https://github.com/nix-community/home-manager/issues/2659
# https://github.com/YaLTeR/niri/wiki/Configuration:-Miscellaneous#environment environment = mapAttrs (name: value: toString value) hm.home.sessionVariables;
environment =
mapAttrs (name: value: toString value)
config.home-manager.users.${config.custom.username}.home.sessionVariables;
# https://github.com/YaLTeR/niri/wiki/Configuration:-Miscellaneous#cursor hotkey-overlay.skip-at-startup = true;
cursor = with config.home-manager.users.${config.custom.username}.gtk.cursorTheme; { prefer-no-csd = true;
# Inherit home-manager GTK settings
inherit size;
theme = name;
hide-after-inactive-ms = 1000 * 15; # Milliseconds #!! Not executed in a shell
hide-when-typing = true; # https://github.com/YaLTeR/niri/wiki/Configuration:-Key-Bindings#spawn
spawn-at-startup = let
home = hm.home.homeDirectory;
in
[
{command = [_1password "--silent"];} # Launch password manager in background
{command = [audio "--init"];} # Enforce audio profile state
{command = [rm "${home}/.cache/walker/clipboard.gob"];} # Clear clipboard history
{command = [sway-audio-idle-inhibit];} # Inhibit while audio is playing
]
++ optionals config.custom.wallpaper [
{command = [wallpaper];}
];
switch-events = {
# Turn display off while inhibiting suspend
lid-close.action.spawn = [niri "msg" "action" "power-off-monitors"];
lid-open.action.spawn = [niri "msg" "action" "power-on-monitors"];
};
}; };
}
# https://github.com/YaLTeR/niri/wiki/Configuration:-Miscellaneous#hotkey-overlay ];
hotkey-overlay.skip-at-startup = true;
# https://github.com/YaLTeR/niri/wiki/Configuration:-Miscellaneous#prefer-no-csd
prefer-no-csd = true;
# https://github.com/YaLTeR/niri/wiki/Configuration:-Switch-Events
switch-events = {
# Turn display off while inhibiting suspend
lid-close.action.spawn = [niri "msg" "action" "power-off-monitors"];
lid-open.action.spawn = [niri "msg" "action" "power-on-monitors"];
};
};
};
}; };
} }

View file

@ -11,161 +11,166 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.${config.custom.username} = { home-manager.sharedModules = [
# https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules {
programs.niri.settings = { # https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules
# HACK: Name workspaces after index to use open-on-workspace rule programs.niri.settings = {
workspaces = { # HACK: Name workspaces after index to use open-on-workspace rule
"1" = {}; #?? niri msg workspaces
"2" = {}; # workspaces = {
"3" = {}; # "1" = {};
}; # "2" = {};
# "3" = {};
# };
window-rules = [ #?? niri msg windows
### Defaults window-rules = [
### Defaults
{ {
# Global # Global
geometry-corner-radius = let geometry-corner-radius = let
radius = config.custom.rounding + 0.0; # Convert to float radius = config.custom.rounding + 0.0; # Convert to float
in { in {
top-left = radius; top-left = radius;
top-right = radius; top-right = radius;
bottom-right = radius; bottom-right = radius;
bottom-left = radius; bottom-left = radius;
}; };
clip-to-geometry = true; clip-to-geometry = true;
} }
{ {
# Startup # Startup
#?? <= 60 secs after niri launches #?? <= 60 secs after niri launches
matches = [{at-startup = true;}]; matches = [{at-startup = true;}];
} }
{ {
# Android # Android
matches = [{app-id = "^[Ww]aydroid.*$";}]; matches = [{app-id = "^[Ww]aydroid.*$";}];
} }
{ {
# Browsers # Browsers
matches = [ matches = [
{app-id = "^brave-browser$";} {app-id = "^brave-browser$";}
{app-id = "^chromium-browser$";} {app-id = "^chromium-browser$";}
{app-id = "^firefox.*$";} {app-id = "^firefox.*$";}
{app-id = "^google-chrome$";} {app-id = "^google-chrome$";}
{app-id = "^vivaldi.*$";} {app-id = "^vivaldi.*$";}
]; ];
open-on-workspace = "2"; #// open-on-workspace = "2";
} }
{ {
# Chats # Chats
matches = [ matches = [
{app-id = "^cinny$";} {app-id = "^cinny$";}
{app-id = "^discord$";} {app-id = "^discord$";}
{app-id = "^Element$";} {app-id = "^Element$";}
{app-id = "^org\.telegram\.desktop$";} {app-id = "^org\.telegram\.desktop$";}
]; ];
} }
{ {
# Dropdown terminal # Dropdown terminal
matches = [{app-id = "^dropdown$";}]; matches = [{app-id = "^dropdown$";}];
} }
{ {
# Editors # Editors
matches = [ matches = [
{app-id = "^codium$";} {app-id = "^codium$";}
{app-id = "^obsidian$";} {app-id = "^obsidian$";}
]; ];
open-on-workspace = "2"; #// open-on-workspace = "2";
} }
{ {
# Files # Files
matches = [{app-id = "^org\.gnome\.Nautilus$";}]; matches = [{app-id = "^org\.gnome\.Nautilus$";}];
} }
{ {
# Games # Games
matches = [ matches = [
{app-id = "^.*\.(exe|x86_64)$";} {app-id = "^.*\.(exe|x86_64)$";}
{app-id = "^love$";} # vrrtest {app-id = "^love$";} # vrrtest
{app-id = "^moe\.launcher\..+$";} # Anime Game Launcher {app-id = "^moe\.launcher\..+$";} # Anime Game Launcher
{app-id = "^net\.retrodeck\.retrodeck$";} {app-id = "^net\.retrodeck\.retrodeck$";}
{app-id = "^steam_app_.+$";} {app-id = "^steam_app_.+$";}
]; ];
open-on-workspace = "1"; default-column-width = {}; # Window-defined
variable-refresh-rate = true; #// open-on-workspace = "1";
} variable-refresh-rate = true;
}
{ {
# Media # Media
matches = [ matches = [
{app-id = "^org\.gnome\.Loupe$";} {app-id = "^org\.gnome\.Loupe$";}
{app-id = "^Spotify$";} {app-id = "^Spotify$";}
{app-id = "^totem$";} {app-id = "^totem$";}
{app-id = "^YouTube Music$";} {app-id = "^YouTube Music$";}
]; ];
open-on-workspace = "3"; #// open-on-workspace = "3";
} }
{ {
# Office # Office
matches = [ matches = [
{app-id = "^draw\.io$";} {app-id = "^draw\.io$";}
{app-id = "^libreoffice$";} {app-id = "^libreoffice$";}
{app-id = "^ONLYOFFICE Desktop Editors$";} {app-id = "^ONLYOFFICE Desktop Editors$";}
]; ];
open-on-workspace = "2"; #// open-on-workspace = "2";
} }
{ {
# PiP # PiP
matches = [{title = "^Picture.in.[Pp]icture$";}]; matches = [{title = "^Picture.in.[Pp]icture$";}];
} }
{ {
# Terminals # Terminals
matches = [ matches = [
{app-id = "^foot$";} {app-id = "^foot$";}
{app-id = "^kitty$";} {app-id = "^kitty$";}
{app-id = "^org\.wezfurlong\.wezterm$";} {app-id = "^org\.wezfurlong\.wezterm$";}
]; ];
} }
{ {
# Vaults # Vaults
matches = [ matches = [
{app-id = "^1Password$";} {app-id = "^1Password$";}
{app-id = "^Bitwarden$";} {app-id = "^Bitwarden$";}
]; ];
} }
{ {
# Virtual machines # Virtual machines
matches = [ matches = [
{app-id = "^(sdl-|wl|x)freerdp$";} {app-id = "^(sdl-|wl|x)freerdp$";}
{app-id = "^looking-glass-client$";} {app-id = "^looking-glass-client$";}
{app-id = "^org\.remmina\.Remmina$";} {app-id = "^org\.remmina\.Remmina$";}
{app-id = "^virt-manager$";} {app-id = "^virt-manager$";}
]; ];
open-on-workspace = "1"; #// open-on-workspace = "1";
} }
### Overrides ### Overrides
]; ];
}; };
}; }
];
}; };
} }