nix/home/desktop/niri/default.nix
2025-09-06 12:29:39 +01:00

150 lines
4.9 KiB
Nix

{
lib,
pkgs,
config,
...
}: {
imports = [
(import ../utils/hypridle.nix)
(import ../utils/waybar.nix)
../../workstation.nix
];
programs.waybar.settings.mainBar.modules-left = ["niri/workspaces" "niri/window"];
programs.waybar.settings.mainBar.modules-right = lib.mkBefore ["niri/language"];
programs.fuzzel = {
enable = true;
settings = {
main = {
terminal = lib.getExe config.programs.terminal;
font = lib.mkForce "${config.stylix.fonts.sansSerif.name}:size=24";
};
};
};
services.hyprpaper.enable = true;
systemd.user.services.hyprpaper.Unit.WantedBy = ["niri.service"];
systemd.user.services.waybar.Unit.WantedBy = ["niri.service"];
home.packages = with pkgs; [brightnessctl];
services.mako.enable = true;
systemd.user.services.mako.Unit.WantedBy = ["niri.service"];
programs.niri = {
settings = {
input.keyboard = {
xkb.layout = "us,gb";
xkb.variant = "dvorak,";
xkb.options = "caps:escape";
};
input.mouse = {
accel-profile = "flat";
};
input.focus-follows-mouse = {
enable = true;
};
input.touchpad = {
dwt = true; # disable when typing
};
prefer-no-csd = true;
spawn-at-startup = [
{command = [(lib.getExe pkgs.xwayland-satellite)];}
];
layout = {
preset-column-widths = [
{proportion = 1.0;}
{proportion = 1.0 / 2.0;}
];
};
environment = {
NIXOS_OZONE_WL = "1";
DISPLAY = ":1";
};
outputs."DP-3" = {
mode = {
width = 1920;
height = 1080;
refresh = 143.855;
};
variable-refresh-rate = true;
scale = 1.0;
};
outputs."HDMI-A-1" = {
mode = {
width = 3840;
height = 2160;
refresh = 120.0;
};
variable-refresh-rate = true;
scale = 2.5;
};
binds = with config.lib.niri.actions; {
"Mod+Return".action.spawn = [(lib.getExe config.programs.terminal)];
"Mod+O".action.spawn = [(lib.getExe pkgs.cosmic-files)];
"Mod+D".action.spawn = [(lib.getExe config.programs.fuzzel.package)];
"Mod+MouseBack".action = open-overview;
"Mod+MouseForward".action = close-overview;
"Mod+WheelScrollRight".action = focus-column-right;
"Mod+Ctrl+WheelScrollRight".action = move-column-right;
"Mod+Right".action = focus-column-right;
"Mod+Ctrl+Right".action = move-column-right;
"Mod+L".action = focus-column-right;
"Mod+Ctrl+L".action = move-column-right;
"Mod+WheelScrollLeft".action = focus-column-left;
"Mod+Ctrl+WheelScrollLeft".action = move-column-left;
"Mod+Left".action = focus-column-left;
"Mod+Ctrl+Left".action = move-column-left;
"Mod+H".action = focus-column-left;
"Mod+Ctrl+H".action = move-column-left;
"Mod+Home".action = focus-column-first;
"Mod+End".action = focus-column-last;
"Mod+Comma".action = consume-or-expel-window-left;
"Mod+Period".action = consume-or-expel-window-right;
"Mod+F".action = fullscreen-window;
"Mod+Q".action = close-window;
"Mod+Shift+Escape".action = quit;
"Mod+Escape".action.spawn = lib.getExe config.programs.hyprlock.package;
"Mod+WheelScrollDown".action = focus-workspace-down;
"Mod+WheelScrollUp".action = focus-workspace-up;
"Mod+Ctrl+WheelScrollDown".action = move-column-to-workspace-down;
"Mod+Ctrl+WheelScrollUp".action = move-column-to-workspace-up;
"Mod+J".action = focus-workspace-down;
"Mod+K".action = focus-workspace-up;
"Mod+Ctrl+J".action = move-column-to-workspace-down;
"Mod+Ctrl+K".action = move-column-to-workspace-up;
"Mod+Down".action = focus-workspace-down;
"Mod+Up".action = focus-workspace-up;
"Mod+Ctrl+Down".action = move-column-to-workspace-down;
"Mod+Ctrl+Up".action = move-column-to-workspace-up;
"Mod+M".action = switch-preset-column-width;
"Mod+G".action = toggle-window-floating;
"Mod+Shift+Ctrl+Alt+Space".action = switch-layout "next";
"Print".action = screenshot;
"XF86AudioRaiseVolume".action.spawn = ["raise-volume"];
"XF86AudioLowerVolume".action.spawn = ["lower-volume"];
"XF86AudioMute".action.spawn = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"];
"XF86AudioMicMute".action.spawn = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"];
"XF86AudioNext".action.spawn = ["playerctl" "next"];
"XF86AudioPrev".action.spawn = ["playerctl" "previous"];
"XF86AudioPlay".action.spawn = ["playerctl" "play-pause"];
"XF86MonBrightnessUp".action.spawn = ["brightness" "+10%"];
"XF86MonBrightnessDown".action.spawn = ["brightness" "10%-"];
};
};
};
}