248 lines
6.6 KiB
Nix

{
config,
pkgs,
lib,
inputs,
...
}:
{
imports = [
inputs.niri.homeModules.config
(
{ ... }:
{
nixpkgs.overlays = [
inputs.niri.overlays.niri
];
}
)
];
programs.niri = {
package = pkgs.niri;
settings = {
prefer-no-csd = true;
input = {
touchpad = {
scroll-factor = 0.4;
};
};
environment = {
DISPLAY = ":0";
};
# skip the hotkey menu thingy
hotkey-overlay.skip-at-startup = true;
layout = {
gaps = 16;
struts = {
# left = 16;
# right = 16;
top = -8;
# bottom = 16;
};
focus-ring = {
enable = true;
active = {
color = "#bf7778";
};
};
};
spawn-at-startup = [
{
command = [
"${lib.getExe config.programs.eww.package}"
"-c"
"${config.programs.eww.configDir}"
"open"
"statusbar"
];
}
# swaybg works on more than just sway (sets a wallpaper)
{
command = [
"${lib.getExe pkgs.swaybg}"
"-i"
"${../wallpaper.png}"
];
}
# Xwayland on niri via xwayland-satellite
{
command = [
"${lib.getExe pkgs.xwayland-satellite}"
config.programs.niri.settings.environment.DISPLAY
];
}
];
window-rules = [
{ draw-border-with-background = false; }
{
geometry-corner-radius =
let
radius = 10.0;
in
{
top-left = radius;
top-right = radius;
bottom-right = radius;
bottom-left = radius;
};
}
{ clip-to-geometry = true; }
{
matches = [
{
app-id = "zen$";
title = "^Picture-in-Picture$";
}
];
open-floating = true;
default-column-width = {
fixed = 480;
};
default-window-height = {
fixed = 270;
};
}
];
# XF86AudioMedia allow-when-locked=true { spawn "playerctl" "play-pause"; }
# XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; }
# XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; }
# XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; }
# https://github.com/sodiboo/niri-flake/issues/591
switch-events = with config.lib.niri.actions; {
"lid-close".action = spawn "${pkgs.swaylock}/bin/swaylock";
};
binds = with config.lib.niri.actions; {
# Application launcher
"Mod+Space".action = spawn [
"${pkgs.fuzzel}/bin/fuzzel"
];
"Mod+O".action = toggle-overview;
# open a terminal
"Mod+T".action = spawn "${pkgs.alacritty}/bin/alacritty";
# lock the screen
"Mod+X".action = spawn "${pkgs.swaylock}/bin/swaylock";
# screenshotting
"Print".action = screenshot;
# https://github.com/sodiboo/niri-flake/commit/a7949bd0f5551fdfffd04cb9735ad3cd3167d624#r153571513
# "Ctrl+Print".action = screenshot-screen;
"Alt+Print".action = screenshot-window;
# Volume control
"XF86AudioRaiseVolume".action = spawn [
"${pkgs.avizo}/bin/volumectl"
"-u"
"up"
];
"XF86AudioLowerVolume".action = spawn [
"${pkgs.avizo}/bin/volumectl"
"-u"
"down"
];
"XF86AudioMute".action = spawn [
"${pkgs.avizo}/bin/volumectl"
"toggle-mute"
];
# Display Brightness control
"XF86MonBrightnessUp".action = spawn [
"${pkgs.avizo}/bin/lightctl"
"up"
];
"XF86MonBrightnessDown".action = spawn [
"${pkgs.avizo}/bin/lightctl"
"down"
];
# color picker and copies to clipboard
"Mod+Ctrl+Alt+C".action = spawn [
"${pkgs.hyprpicker}/bin/hyprpicker"
"-za"
];
# "Framework" key (F12)
# "XF86AudioMedia".action = spawn [];
# Force close a window
"Mod+Q".action = close-window;
"Mod+Shift+Q".action = quit;
# bindings for window management
"Mod+H".action = focus-column-left;
"Mod+J".action = focus-window-down;
"Mod+K".action = focus-window-up;
"Mod+L".action = focus-column-right;
"Mod+Ctrl+H".action = move-column-left;
"Mod+Ctrl+J".action = move-window-down;
"Mod+Ctrl+K".action = move-window-up;
"Mod+Ctrl+L".action = move-column-right;
#fine adjustments to height and width of window
"Mod+Minus".action = set-column-width "-10%";
"Mod+Equal".action = set-column-width "+10%";
"Mod+Shift+Minus".action = set-window-height "-10%";
"Mod+Shift+Equal".action = set-window-height "+10%";
"Mod+Home".action = focus-column-first;
"Mod+End".action = focus-column-last;
"Mod+Ctrl+Home".action = move-column-to-first;
"Mod+Ctrl+End".action = move-column-to-last;
"Mod+Shift+H".action = focus-monitor-left;
"Mod+Shift+J".action = focus-monitor-down;
"Mod+Shift+K".action = focus-monitor-up;
"Mod+Shift+L".action = focus-monitor-right;
"Mod+Shift+Ctrl+H".action = move-column-to-monitor-left;
"Mod+Shift+Ctrl+J".action = move-column-to-monitor-down;
"Mod+Shift+Ctrl+K".action = move-column-to-monitor-up;
"Mod+Shift+Ctrl+L".action = move-column-to-monitor-right;
"Mod+Page_Down".action = focus-workspace-down;
"Mod+Page_Up".action = focus-workspace-up;
"Mod+U".action = focus-workspace-down;
"Mod+I".action = focus-workspace-up;
# move a window up and down workspaces
"Mod+Ctrl+Page_Down".action = move-column-to-workspace-down;
"Mod+Ctrl+Page_Up".action = move-column-to-workspace-up;
"Mod+Ctrl+U".action = move-column-to-workspace-down;
"Mod+Ctrl+I".action = move-column-to-workspace-up;
# does little squeeze thing into the left or right position with another window
"Mod+BracketLeft".action = consume-or-expel-window-left;
"Mod+BracketRight".action = consume-or-expel-window-right;
"Mod+R".action = switch-preset-column-width;
"Mod+F".action = maximize-column;
"Mod+Shift+F".action = fullscreen-window;
"Mod+C".action = center-column;
};
};
};
}