niri: init config

This commit is contained in:
Nico 2025-05-03 16:16:02 +10:00
parent 20ff31e808
commit 19d7cc6689

View file

@ -0,0 +1,316 @@
//
// Startup
//
spawn-at-startup "swww-daemon"
spawn-at-startup "waybar"
spawn-at-startup "swaync"
spawn-at-startup "walker --gapplication-service"
spawn-at-startup "opensnitch-ui"
spawn-at-startup "steam -silent"
spawn-at-startup "xwayland-satellite"
//
// Environment
//
environment {
DISPLAY ":0"
}
//
// Display
//
output "eDP-1" {
// Disable output
// off
// Resolution and, optionally, refresh rate of the output.
// The format is "<width>x<height>" or "<width>x<height>@<refresh rate>".
// If the refresh rate is omitted, niri will pick the highest refresh rate
// for the resolution.
// If the mode is omitted altogether or is invalid, niri will pick one automatically.
// Run `niri msg outputs` while inside a niri instance to list all outputs and their modes.
mode "1920x1080@60"
// You can use integer or fractional scale, for example use 1.5 for 150% scale.
scale 1
// Transform allows to rotate the output counter-clockwise, valid values are:
// normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270.
transform "normal"
// Position of the output in the global coordinate space.
position x=1280 y=0
}
// Inputs
input {
keyboard {
xkb {
// You can set rules, model, layout, variant and options.
// For more information, see xkeyboard-config(7).
options "caps:super"
}
}
touchpad {
// off
tap
dwt // disable trackpad when typing
disabled-on-external-mouse
natural-scroll
// dwtp
// drag-lock
// accel-speed 0.2
// accel-profile "flat"
// scroll-method "two-finger"
}
mouse {
// off
// natural-scroll
// accel-speed 0.2
// accel-profile "flat"
// scroll-method "no-scroll"
}
trackpoint {
// off
// natural-scroll
// accel-speed 0.2
// accel-profile "flat"
// scroll-method "on-button-down"
// scroll-button 273
// middle-emulation
}
}
//
// Decorations
//
// https://github.com/YaLTeR/niri/wiki/Configuration:-Layout
layout {
// Set gaps around windows in logical pixels.
gaps 16
// When to center a column when changing focus, options are:
// - "never", default behavior, focusing an off-screen column will keep at the left
// or right edge of the screen.
// - "always", the focused column will always be centered.
// - "on-overflow", focusing a column will center it if it doesn't fit
// together with the previously focused column.
center-focused-column "never"
// You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between.
preset-column-widths {
// Proportion sets the width as a fraction of the output width, taking gaps into account.
proportion 0.33333
proportion 0.5
proportion 0.66667
proportion 0.8
}
// You can change the default width of the new windows.
default-column-width { proportion 0.5; }
// If you leave the brackets empty, the windows themselves will decide their initial width.
// default-column-width {}
focus-ring {
// Window borders
// off
// How many logical pixels the ring extends out from the windows.
width 2
// Colors can be set in a variety of ways:
// - CSS named colors: "red"
// - RGB hex: "#rgb", "#rgba", "#rrggbb", "#rrggbbaa"
// - CSS-like notation: "rgb(255, 127, 0)", rgba(), hsl() and a few others.
active-color "#7fc8ff"
inactive-color "#505050"
// active-gradient from="#80c8ff" to="#bbddff" angle=45
}
// Struts shrink the area occupied by windows, similarly to layer-shell panels.
// You can think of them as a kind of outer gaps. They are set in logical pixels.
// Left and right struts will cause the next window to the side to always be visible.
// Top and bottom struts will simply add outer gaps in addition to the area occupied by
// layer-shell panels and regular gaps.
struts {
left 8
right 8
// top 64
// bottom 64
}
}
animations {
// Slow down all animations by this factor. Values below 1 speed them up instead.
// slowdown 3.0
// off
}
// If the client will specifically ask for CSD, the request will be honored.
// Additionally, clients will be informed that they are tiled, removing some client-side rounded corners.
// This option will also fix border/focus ring drawing behind some semitransparent windows.
prefer-no-csd
// Rounded Corners
window-rule {
geometry-corner-radius 12
clip-to-geometry true
}
//
// Window Rules
//
window-rule {
// Open Firefox picture-in-picture as floating
match app-id=r#"firefox$"# title="^Picture-in-Picture$"
open-floating true
}
window-rule {
// Blockout password managers from screen capture
match app-id=r#"^org\.keepassxc\.KeePassXC$"#
match app-id=r#"^org\.gnome\.World\.Secrets$"#
block-out-from "screen-capture"
}
//
// "Static" Workspaces
//
workspace "a"
workspace "b"
workspace "c"
workspace "d"
workspace "e"
workspace "f"
workspace "g"
workspace "h"
//
// Binds
//
binds {
// Keys consist of modifiers separated by + signs, followed by an XKB key name
// in the end. To find an XKB name for a particular key, you may use a program
// like wev. "Mod" is a special modifier equal to Super when running on a TTY, and to Alt
// when running as a winit window.
// Essential keys
Super+Q { spawn "ghostty"; }
Super+D { spawn "walker"; }
Super+B { spawn "firefox"; }
Super+V { spawn "~/.config/hypr/hyprlock.sh"; }
Super+W { close-window; }
// Volume Keys
XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "2%+"; }
XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "2%-"; }
XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; }
XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; }
// Brightness Keys
XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "s" "+2%"; }
XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "s" "2%-"; }
// Window Management
Mod+H { focus-column-left; }
Mod+J { focus-window-down; }
Mod+K { focus-window-up; }
Mod+L { focus-column-right; }
Mod+Shift+H { move-column-left; }
Mod+Shift+J { move-window-down; }
Mod+Shift+K { move-window-up; }
Mod+Shift+L { move-column-right; }
Mod+Home { focus-column-first; }
Mod+End { focus-column-last; }
Mod+Ctrl+Home { move-column-to-first; }
Mod+Ctrl+End { move-column-to-last; }
// Workspaces
Mod+1 { focus-workspace "a"; }
Mod+2 { focus-workspace "b"; }
Mod+3 { focus-workspace "c"; }
Mod+4 { focus-workspace "d"; }
Mod+5 { focus-workspace "e"; }
Mod+6 { focus-workspace "f"; }
Mod+7 { focus-workspace "g"; }
Mod+8 { focus-workspace "h"; }
Mod+9 { focus-workspace 1; }
Mod+Shift+1 { move-window-to-workspace "a"; }
Mod+Shift+2 { move-window-to-workspace "b"; }
Mod+Shift+3 { move-window-to-workspace "c"; }
Mod+Shift+4 { move-window-to-workspace "d"; }
Mod+Shift+5 { move-window-to-workspace "e"; }
Mod+Shift+6 { move-window-to-workspace "f"; }
Mod+Shift+7 { move-window-to-workspace "g"; }
Mod+Shift+8 { move-window-to-workspace "h"; }
Mod+Shift+9 { move-window-to-workspace 9; }
// Move Focus between workspaces sequentially
Mod+Shift+U { move-workspace-down; }
Mod+Shift+I { move-workspace-up; }
// Switches focus between the current and the previous workspace.
Mod+Tab { focus-workspace-previous; }
// Sizing
Mod+R { switch-preset-column-width; }
Mod+Shift+R { switch-preset-window-height; }
Mod+Ctrl+R { reset-window-height; }
Mod+F { maximize-column; }
Mod+Shift+F { fullscreen-window; }
Mod+Ctrl+F { expand-column-to-available-width; }
Mod+C { center-column; }
// Sizing
Mod+BracketLeft { consume-or-expel-window-left; }
Mod+BracketRight { consume-or-expel-window-right; }
Super+C { consume-or-expel-window-right; }
Mod+Comma { consume-window-into-column; }
Mod+Period { expel-window-from-column; }
// Finer width adjustments.
Mod+Minus { set-column-width "-10%"; }
Mod+Equal { set-column-width "+10%"; }
Mod+Shift+Minus { set-window-height "-10%"; }
Mod+Shift+Equal { set-window-height "+10%"; }
// Screenshots
Super+S { screenshot; }
Print { screenshot; }
Ctrl+Print { screenshot-screen; }
Alt+Print { screenshot-window; }
// Toggling Floating
Mod+Space { toggle-window-floating; }
Mod+Shift+Space { switch-focus-between-floating-and-tiling; }
// Misc
Mod+M { quit; } // exits niri
Ctrl+Alt+Delete { quit; }
Mod+Shift+P { power-off-monitors; } // turns off monitors until input
Mod+Shift+Slash { show-hotkey-overlay; } // show an overlay of keybinds
Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } // turn off applications inhibiting/stealing keyboard shortcuts
}
//
// Misc
//
// A ~ at the front will be expanded to the home directory.
// The path is formatted with strftime(3) to give you the screenshot date and time.
screenshot-path "/tmp/screenshots-niri"