From 77d730d1771340f5dc9ce3ae22ea8078f7c3fa9a Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Mon, 18 Nov 2024 23:56:16 +0100 Subject: [PATCH] niri config !! --- extra/niri.kdl | 189 ++++++----------------------------- hosts/muos/configuration.nix | 18 +++- 2 files changed, 47 insertions(+), 160 deletions(-) diff --git a/extra/niri.kdl b/extra/niri.kdl index aa45447..461f774 100644 --- a/extra/niri.kdl +++ b/extra/niri.kdl @@ -1,126 +1,46 @@ -// This config is in the KDL format: https://kdl.dev -// "/-" comments out the following node. -// Check the wiki for a full description of the configuration: -// https://github.com/YaLTeR/niri/wiki/Configuration:-Overview - -// Input device configuration. -// Find the full list of options on the wiki: -// https://github.com/YaLTeR/niri/wiki/Configuration:-Input input { keyboard { xkb { - // You can set rules, model, layout, variant and options. - // For more information, see xkeyboard-config(7). - - // For example: // layout "us,ru" // options "grp:win_space_toggle,compose:ralt,ctrl:nocaps" } } - // Next sections include libinput settings. - // Omitting settings disables them, or leaves them at their default values. touchpad { - // off tap - // dwt - // dwtp natural-scroll - // accel-speed 0.2 - // accel-profile "flat" - // scroll-method "two-finger" - // disabled-on-external-mouse } 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 + off } - // Uncomment this to make the mouse warp to the center of newly focused windows. - // warp-mouse-to-focus - // Focus windows and outputs automatically when moving the mouse into them. // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen. - // focus-follows-mouse max-scroll-amount="0%" + focus-follows-mouse max-scroll-amount="40%" } -// You can configure outputs by their name, which you can find -// by running `niri msg outputs` while inside a niri instance. -// The built-in laptop monitor is usually called "eDP-1". -// Find more information on the wiki: -// https://github.com/YaLTeR/niri/wiki/Configuration:-Outputs -// Remember to uncomment the node by removing "/-"! -/-output "eDP-1" { - // Uncomment this line to disable this output. - // off - - // Resolution and, optionally, refresh rate of the output. - // The format is "x" or "x@". - // 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@120.030" - - // You can use integer or fractional scale, for example use 1.5 for 150% scale. - scale 2 - - // Transform allows to rotate the output counter-clockwise, valid values are: - // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270. +output "eDP-1" { + mode "2256x1504@59.999" + scale 1 transform "normal" - - // Position of the output in the global coordinate space. - // This affects directional monitor actions like "focus-monitor-left", and cursor movement. - // The cursor can only move between directly adjacent outputs. - // Output scale and rotation has to be taken into account for positioning: - // outputs are sized in logical, or scaled, pixels. - // For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080, - // so to put another output directly adjacent to it on the right, set its x to 1920. - // If the position is unset or results in an overlap, the output is instead placed - // automatically. - position x=1280 y=0 + position x=0 y=0 } -// Settings that influence how windows are positioned and sized. -// Find more information on the wiki: -// https://github.com/YaLTeR/niri/wiki/Configuration:-Layout layout { // Set gaps around windows in logical pixels. - gaps 16 + gaps 8 - // 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" + center-focused-column "on-overflow" // 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. - // For example, you can perfectly fit four windows sized "proportion 0.25" on an output. - // The default preset widths are 1/3, 1/2 and 2/3 of the output. - proportion 0.33333 proportion 0.5 proportion 0.66667 - - // Fixed sets the width in logical pixels exactly. - // fixed 1920 + proportion 1.0 } // You can also customize the heights that "switch-preset-window-height" (Mod+Shift+R) toggles between. @@ -148,7 +68,7 @@ layout { // off // How many logical pixels the ring extends out from the windows. - width 4 + width 2 // Colors can be set in a variety of ways: // - CSS named colors: "red" @@ -168,27 +88,18 @@ layout { // You can use any CSS linear-gradient tool on the web to set these up. // Changing the color space is also supported, check the wiki for more info. // - // active-gradient from="#80c8ff" to="#bbddff" angle=45 + active-gradient from="#80c8ff" to="#bbddff" angle=45 // You can also color the gradient relative to the entire view // of the workspace, rather than relative to just the window itself. // To do that, set relative-to="workspace-view". // - // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" + inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" } // You can also add a border. It's similar to the focus ring, but always visible. border { - // The settings are the same as for the focus ring. - // If you enable the border, you probably want to disable the focus ring. off - - width 4 - active-color "#ffc87f" - inactive-color "#505050" - - // active-gradient from="#ffbb66" to="#ffc880" angle=45 relative-to="workspace-view" - // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" } // Struts shrink the area occupied by windows, similarly to layer-shell panels. @@ -215,7 +126,7 @@ layout { // 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. // After enabling or disabling this, you need to restart the apps for this to take effect. -// prefer-no-csd +prefer-no-csd // You can change the path where screenshots are saved. // A ~ at the front will be expanded to the home directory. @@ -252,9 +163,8 @@ window-rule { // Example: block out two password managers from screen capture. // (This example rule is commented out with a "/-" in front.) -/-window-rule { +window-rule { match app-id=r#"^org\.keepassxc\.KeePassXC$"# - match app-id=r#"^org\.gnome\.World\.Secrets$"# block-out-from "screen-capture" @@ -264,8 +174,8 @@ window-rule { // Example: enable rounded corners for all windows. // (This example rule is commented out with a "/-" in front.) -/-window-rule { - geometry-corner-radius 12 +window-rule { + geometry-corner-radius 8 clip-to-geometry true } @@ -285,9 +195,10 @@ binds { Mod+Shift+Slash { show-hotkey-overlay; } // Suggested binds for running programs: terminal, app launcher, screen locker. - Mod+T { spawn "alacritty"; } - Mod+D { spawn "fuzzel"; } - Super+Alt+L { spawn "swaylock"; } + Mod+Return { spawn "@kitty@"; } + Mod+Space { spawn "@wofilaunch@"; } + Mod+P { spawn "@wofipower@"; } + Super+Alt+L { spawn "@swaylock@"; } // You can also use a shell. Do this if you need pipes, multiple commands, etc. // Note: the entire command goes as a single argument in the end. @@ -295,56 +206,36 @@ binds { // Example volume keys mappings for PipeWire & WirePlumber. // The allow-when-locked=true property makes them work even when the session is locked. - XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; } - XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; } + XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "1%+"; } + XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "1%-"; } 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"; } - Mod+Q { close-window; } + Mod+Shift+Q { close-window; } - Mod+Left { focus-column-left; } - Mod+Down { focus-window-down; } - Mod+Up { focus-window-up; } - Mod+Right { focus-column-right; } Mod+H { focus-column-left; } - Mod+J { focus-window-down; } - Mod+K { focus-window-up; } + Mod+J { focus-window-or-workspace-down; } + Mod+K { focus-window-or-workspace-up; } Mod+L { focus-column-right; } - Mod+Ctrl+Left { move-column-left; } - Mod+Ctrl+Down { move-window-down; } - Mod+Ctrl+Up { move-window-up; } - Mod+Ctrl+Right { move-column-right; } Mod+Ctrl+H { move-column-left; } - Mod+Ctrl+J { move-window-down; } - Mod+Ctrl+K { move-window-up; } + Mod+Ctrl+J { move-window-down-or-to-workspace-down; } + Mod+Ctrl+K { move-window-up-or-to-workspace-up; } Mod+Ctrl+L { move-column-right; } // Alternative commands that move across workspaces when reaching // the first or last window in a column. - // Mod+J { focus-window-or-workspace-down; } - // Mod+K { focus-window-or-workspace-up; } - // Mod+Ctrl+J { move-window-down-or-to-workspace-down; } - // Mod+Ctrl+K { move-window-up-or-to-workspace-up; } Mod+Home { focus-column-first; } Mod+End { focus-column-last; } Mod+Ctrl+Home { move-column-to-first; } Mod+Ctrl+End { move-column-to-last; } - Mod+Shift+Left { focus-monitor-left; } - Mod+Shift+Down { focus-monitor-down; } - Mod+Shift+Up { focus-monitor-up; } - Mod+Shift+Right { focus-monitor-right; } Mod+Shift+H { focus-monitor-left; } Mod+Shift+J { focus-monitor-down; } Mod+Shift+K { focus-monitor-up; } Mod+Shift+L { focus-monitor-right; } - Mod+Shift+Ctrl+Left { move-column-to-monitor-left; } - Mod+Shift+Ctrl+Down { move-column-to-monitor-down; } - Mod+Shift+Ctrl+Up { move-column-to-monitor-up; } - Mod+Shift+Ctrl+Right { move-column-to-monitor-right; } Mod+Shift+Ctrl+H { move-column-to-monitor-left; } Mod+Shift+Ctrl+J { move-column-to-monitor-down; } Mod+Shift+Ctrl+K { move-column-to-monitor-up; } @@ -459,29 +350,13 @@ binds { Mod+Shift+F { fullscreen-window; } Mod+C { center-column; } - // Finer width adjustments. - // This command can also: - // * set width in pixels: "1000" - // * adjust width in pixels: "-5" or "+5" - // * set width as a percentage of screen width: "25%" - // * adjust width as a percentage of screen width: "-10%" or "+10%" - // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0, - // set-column-width "100" will make the column occupy 200 physical screen pixels. - Mod+Minus { set-column-width "-10%"; } - Mod+Equal { set-column-width "+10%"; } + Mod+Minus { set-column-width "-5%"; } + Mod+Equal { set-column-width "+5%"; } - // Finer height adjustments when in column with other windows. - Mod+Shift+Minus { set-window-height "-10%"; } - Mod+Shift+Equal { set-window-height "+10%"; } - - // Actions to switch layouts. - // Note: if you uncomment these, make sure you do NOT have - // a matching layout switch hotkey configured in xkb options above. - // Having both at once on the same hotkey will break the switching, - // since it will switch twice upon pressing the hotkey (once by xkb, once by niri). - // Mod+Space { switch-layout "next"; } - // Mod+Shift+Space { switch-layout "prev"; } + Mod+Shift+Minus { set-window-height "-5%"; } + Mod+Shift+Equal { set-window-height "+5%"; } + Mod+Shift+S { screenshot; } Print { screenshot; } Ctrl+Print { screenshot-screen; } Alt+Print { screenshot-window; } diff --git a/hosts/muos/configuration.nix b/hosts/muos/configuration.nix index 603a1b2..ecd025f 100644 --- a/hosts/muos/configuration.nix +++ b/hosts/muos/configuration.nix @@ -93,9 +93,21 @@ } ]; extraConfig = { - xdg.configFile = { - "niri/config.kdl".source = ../../extra/niri.kdl; - }; + xdg.configFile = + let + wpkgs = inputs.self.packages.${pkgs.system}; + in + { + "niri/config.kdl".source = pkgs.substituteAll { + src = ../../extra/niri.kdl; + env = { + kitty = "${pkgs.kitty}/bin/kitty"; + wofilaunch = "${wpkgs.wofi-launch}/bin/wofi-launch"; + wofipower = "${wpkgs.wofi-power}/bin/wofi-power"; + swaylock = "${pkgs.swaylock}/bin/swaylock"; + }; + }; + }; }; }; "root" = import ./root.nix;