diff --git a/home/modules/niri.nix b/home/modules/niri.nix index 77c9614..2772a02 100644 --- a/home/modules/niri.nix +++ b/home/modules/niri.nix @@ -1,187 +1,203 @@ { config, lib, ... }: let - c = config.theme.colors; + c = config.theme.colors; + proportion = toString config.myConfig.niri.defaultColumnProportion; + presetWidths = builtins.concatStringsSep "\n " + (map (p: "proportion ${toString p}") config.myConfig.niri.presetColumnWidths); in { - home.file.".config/xdg-desktop-portal/portals.conf".text = '' - [preferred] - default=gtk - org.freedesktop.impl.portal.Screenshot=gnome - org.freedesktop.impl.portal.ScreenCast=gnome - ''; - home.file.".config/niri/config.kdl" = { - force = true; - text = '' - config-notification { - disable-failed - } + options.myConfig.niri = { + defaultColumnProportion = lib.mkOption { + type = lib.types.float; + default = 0.5; + description = "Default column width proportion"; + }; + presetColumnWidths = lib.mkOption { + type = lib.types.listOf lib.types.float; + default = [ 0.33333 0.5 0.66667 ]; + description = "Preset column width proportions"; + }; + }; - gestures { - hot-corners { - off - } - } - - input { - keyboard { - xkb { } - numlock - } - touchpad { - tap - natural-scroll - } - mouse { } - trackpoint { } - } - - layout { - background-color "transparent" - center-focused-column "never" - preset-column-widths { - proportion 0.33333 - proportion 0.5 - proportion 0.66667 - } - default-column-width { proportion 0.5; } - border { - off - width 4 - active-color "#707070" - inactive-color "#d0d0d0" - urgent-color "${c.red_b}" - } - shadow { - softness 30 - spread 5 - offset x=0 y=5 - color "#0007" - } - struts { } - } - - layer-rule { - match namespace="^quickshell$" - place-within-backdrop true - } - - overview { - workspace-shadow { - off - } - } - - environment { - XDG_CURRENT_DESKTOP "niri" - } - - hotkey-overlay { - skip-at-startup - } - - prefer-no-csd - screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png" - - animations { - workspace-switch { - spring damping-ratio=0.80 stiffness=523 epsilon=0.0001 - } - window-open { - duration-ms 150 - curve "ease-out-expo" - } - window-close { - duration-ms 150 - curve "ease-out-quad" - } - horizontal-view-movement { - spring damping-ratio=0.85 stiffness=423 epsilon=0.0001 - } - window-movement { - spring damping-ratio=0.75 stiffness=323 epsilon=0.0001 - } - window-resize { - spring damping-ratio=0.85 stiffness=423 epsilon=0.0001 - } - config-notification-open-close { - spring damping-ratio=0.65 stiffness=923 epsilon=0.001 - } - screenshot-ui-open { - duration-ms 200 - curve "ease-out-quad" - } - overview-open-close { - spring damping-ratio=0.85 stiffness=800 epsilon=0.0001 - } - } - - window-rule { - match app-id=r#"^org\.wezfurlong\.wezterm$"# - default-column-width {} - } - window-rule { - match app-id=r#"^org\.gnome\."# - draw-border-with-background false - geometry-corner-radius 12 - clip-to-geometry true - } - window-rule { - match app-id=r#"^gnome-control-center$"# - match app-id=r#"^pavucontrol$"# - match app-id=r#"^nm-connection-editor$"# - default-column-width { proportion 0.5; } - open-floating false - } - window-rule { - match app-id=r#"^gnome-calculator$"# - match app-id=r#"^galculator$"# - match app-id=r#"^blueman-manager$"# - match app-id=r#"^org\.gnome\.Nautilus$"# - match app-id=r#"^xdg-desktop-portal$"# - open-floating true - } - window-rule { - match app-id=r#"^steam$"# title=r#"^notificationtoasts_\d+_desktop$"# - default-floating-position x=10 y=10 relative-to="bottom-right" - open-focused false - } - window-rule { - match app-id=r#"^org\.wezfurlong\.wezterm$"# - match app-id="Alacritty" - match app-id="zen" - match app-id="com.mitchellh.ghostty" - match app-id="kitty" - draw-border-with-background false - } - window-rule { - match app-id=r#"firefox$"# title="^Picture-in-Picture$" - match app-id="zoom" - open-floating true - } - window-rule { - match app-id=r#"org.quickshell$"# - open-floating true - } - - recent-windows { - binds { - Alt+Tab { next-window scope="output"; } - Alt+Shift+Tab { previous-window scope="output"; } - Alt+grave { next-window filter="app-id"; } - Alt+Shift+grave { previous-window filter="app-id"; } - } - } - - debug { - honor-xdg-activation-with-invalid-serial - } - - include "dms/colors.kdl" - include "dms/layout.kdl" - include "dms/alttab.kdl" - include "dms/binds.kdl" - include "dms/outputs.kdl" - include "dms/cursor.kdl" + config = { + home.file.".config/xdg-desktop-portal/portals.conf".text = '' + [preferred] + default=gtk + org.freedesktop.impl.portal.Screenshot=gnome + org.freedesktop.impl.portal.ScreenCast=gnome ''; + home.file.".config/niri/config.kdl" = { + force = true; + text = '' + config-notification { + disable-failed + } + + gestures { + hot-corners { + off + } + } + + input { + keyboard { + xkb { } + numlock + } + touchpad { + tap + natural-scroll + } + mouse { } + trackpoint { } + } + + layout { + background-color "transparent" + center-focused-column "never" + preset-column-widths { + ${presetWidths} + } + default-column-width { proportion ${proportion}; } + border { + off + width 4 + active-color "#707070" + inactive-color "#d0d0d0" + urgent-color "${c.red_b}" + } + shadow { + softness 30 + spread 5 + offset x=0 y=5 + color "#0007" + } + struts { } + } + + layer-rule { + match namespace="^quickshell$" + place-within-backdrop true + } + + overview { + workspace-shadow { + off + } + } + + environment { + XDG_CURRENT_DESKTOP "niri" + } + + hotkey-overlay { + skip-at-startup + } + + prefer-no-csd + screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png" + + animations { + workspace-switch { + spring damping-ratio=0.80 stiffness=523 epsilon=0.0001 + } + window-open { + duration-ms 150 + curve "ease-out-expo" + } + window-close { + duration-ms 150 + curve "ease-out-quad" + } + horizontal-view-movement { + spring damping-ratio=0.85 stiffness=423 epsilon=0.0001 + } + window-movement { + spring damping-ratio=0.75 stiffness=323 epsilon=0.0001 + } + window-resize { + spring damping-ratio=0.85 stiffness=423 epsilon=0.0001 + } + config-notification-open-close { + spring damping-ratio=0.65 stiffness=923 epsilon=0.001 + } + screenshot-ui-open { + duration-ms 200 + curve "ease-out-quad" + } + overview-open-close { + spring damping-ratio=0.85 stiffness=800 epsilon=0.0001 + } + } + + window-rule { + match app-id=r#"^org\.wezfurlong\.wezterm$"# + default-column-width {} + } + window-rule { + match app-id=r#"^org\.gnome\."# + draw-border-with-background false + geometry-corner-radius 12 + clip-to-geometry true + } + window-rule { + match app-id=r#"^gnome-control-center$"# + match app-id=r#"^pavucontrol$"# + match app-id=r#"^nm-connection-editor$"# + default-column-width { proportion 0.5; } + open-floating false + } + window-rule { + match app-id=r#"^gnome-calculator$"# + match app-id=r#"^galculator$"# + match app-id=r#"^blueman-manager$"# + match app-id=r#"^org\.gnome\.Nautilus$"# + match app-id=r#"^xdg-desktop-portal$"# + open-floating true + } + window-rule { + match app-id=r#"^steam$"# title=r#"^notificationtoasts_\d+_desktop$"# + default-floating-position x=10 y=10 relative-to="bottom-right" + open-focused false + } + window-rule { + match app-id=r#"^org\.wezfurlong\.wezterm$"# + match app-id="Alacritty" + match app-id="zen" + match app-id="com.mitchellh.ghostty" + match app-id="kitty" + draw-border-with-background false + } + window-rule { + match app-id=r#"firefox$"# title="^Picture-in-Picture$" + match app-id="zoom" + open-floating true + } + window-rule { + match app-id=r#"org.quickshell$"# + open-floating true + } + + recent-windows { + binds { + Alt+Tab { next-window scope="output"; } + Alt+Shift+Tab { previous-window scope="output"; } + Alt+grave { next-window filter="app-id"; } + Alt+Shift+grave { previous-window filter="app-id"; } + } + } + + debug { + honor-xdg-activation-with-invalid-serial + } + + include "dms/colors.kdl" + include "dms/layout.kdl" + include "dms/alttab.kdl" + include "dms/binds.kdl" + include "dms/outputs.kdl" + include "dms/cursor.kdl" + ''; + }; }; } diff --git a/home/profiles/desktop.nix b/home/profiles/desktop.nix index 3a113ff..cb5ddc1 100644 --- a/home/profiles/desktop.nix +++ b/home/profiles/desktop.nix @@ -1,12 +1,14 @@ { pkgs, ... }: { - myConfig.wayland.enable = true; imports = [ ../modules/kitty.nix ../modules/emacs.nix ../modules/niri.nix ../modules/dms.nix ]; + myConfig.wayland.enable = true; + myConfig.niri.defaultColumnProportion = 0.33333; + myConfig.niri.presetColumnWidths = [ 0.33333 0.5 0.66667 1.0 ]; home.packages = with pkgs; [ # desktop specific packages ]; diff --git a/home/profiles/notebook.nix b/home/profiles/notebook.nix index 8ac9929..9754a54 100644 --- a/home/profiles/notebook.nix +++ b/home/profiles/notebook.nix @@ -7,6 +7,8 @@ ../modules/dms.nix ]; myConfig.wayland.enable = true; + myConfig.niri.defaultColumnProportion = 1.0; + myConfig.niri.presetColumnWidths = [ 0.5 1.0 ]; home.packages = with pkgs; [ powertop acpi