From 8885ccc00ef4a47f27250d54b67c09d58454a7aa Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 2 Sep 2025 15:27:55 -0500 Subject: [PATCH] making niri better --- flake.nix | 1 + home/home.nix | 14 +++--- home/modules/niri.nix | 113 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 107 insertions(+), 21 deletions(-) diff --git a/flake.nix b/flake.nix index 48998a4..33349b8 100644 --- a/flake.nix +++ b/flake.nix @@ -153,6 +153,7 @@ home-manager.nixosModules.home-manager # hyprland.nixosModules.default # stylix.nixosModules.stylix + niri.nixosModules.niri # nixos-cosmic.nixosModules.default nixos-hardware.nixosModules.common-gpu-amd { diff --git a/home/home.nix b/home/home.nix index 8f08377..af78928 100644 --- a/home/home.nix +++ b/home/home.nix @@ -46,17 +46,17 @@ in { enable = true; config = { common = { - default = [ "hyprland" ]; - "org.freedesktop.impl.portal.FileChooser" = [ "kde" ]; - "org.freedesktop.impl.portal.OpenUri" = [ "kde" ]; + default = [ "cosmic" ]; + "org.freedesktop.impl.portal.FileChooser" = [ "cosmic" ]; + "org.freedesktop.impl.portal.OpenUri" = [ "cosmic" ]; }; hyprland = { default = [ "hyprland" ]; - "org.freedesktop.impl.portal.FileChooser" = [ "kde" ]; - "org.freedesktop.impl.portal.OpenUri" = [ "kde" ]; + "org.freedesktop.impl.portal.FileChooser" = [ "cosmic" ]; + "org.freedesktop.impl.portal.OpenUri" = [ "cosmic" ]; }; }; - extraPortals = [ pkgs.kdePackages.xdg-desktop-portal-kde pkgs.xdg-desktop-portal-gtk ]; + extraPortals = [ pkgs.kdePackages.xdg-desktop-portal-kde pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-cosmic ]; xdgOpenUsePortal = true; }; mimeApps = { @@ -1614,6 +1614,7 @@ in { exec = "alacritty -e mpv --profile=slow %U"; terminal = true; categories = [ "Application" ]; + noDisplay = true; mimeType = [ "audio/ogg" "audio/mpeg" @@ -1627,6 +1628,7 @@ in { genericName = "Show images in current directory in IMV"; exec = "/home/chris/bin/rifle-imv %U"; terminal = false; + noDisplay = true; categories = [ "Application" ]; mimeType = [ "image/gif" "image/jpeg" "image/png" "image/heif" ]; }; diff --git a/home/modules/niri.nix b/home/modules/niri.nix index d478029..2184042 100644 --- a/home/modules/niri.nix +++ b/home/modules/niri.nix @@ -58,6 +58,35 @@ in home.packages = with pkgs; [ cosmic-extra-niri ]; + xdg.desktopEntries = { + cosmic-settings = { + name = "Cosmic Settings"; + genericName = "Cosmic Settings App"; + exec = "${pkgs.cosmic-settings}/bin/cosmic-settings"; + terminal = false; + type = "Application"; + categories = [ "Application" "Settings" "COSMIC" ]; + icon = "com.system76.CosmicSettings"; + }; + cosmic-settings-power = { + name = "Cosmic Power Settings"; + genericName = "Cosmic Power Settings App"; + exec = "${pkgs.cosmic-settings}/bin/cosmic-settings power"; + terminal = false; + type = "Application"; + categories = [ "Application" "Settings" "COSMIC" ]; + icon = "preferences-power-and-battery"; + }; + cosmic-settings-about = { + name = "Cosmic About Settings"; + genericName = "Cosmic About Settings App"; + exec = "${pkgs.cosmic-settings}/bin/cosmic-settings about"; + terminal = false; + type = "Application"; + categories = [ "Application" "Settings" "COSMIC" ]; + icon = "preferences-about"; + }; + }; programs.niri = { # enable = true; settings = { @@ -66,10 +95,12 @@ in in { "XF86AudioRaiseVolume".action.spawn = ["pamixer" "--allow-boost" "-i" "5"]; "XF86AudioLowerVolume".action.spawn = ["pamixer" "--allow-boost" "-d" "5"]; - "Super+E".action.spawn = ["${pkgs.nushell}/bin/nu" "/home/chris/nirilof emacs 'emacslient -c'"]; + "Super+E".action.spawn = ["${pkgs.nushell}/bin/nu" "/home/chris/bin/nirilof" "emacs" "'emacslient -c'"]; "Super+Return".action.spawn = "alacritty"; - "Super+B".action = spawn ["${pkgs.nushell}/bin/nu" "/home/chris/nirilof org.qutebrowser.qutebrowser qutebrowser"]; + "Super+B".action = spawn ["${pkgs.nushell}/bin/nu" "/home/chris/bin/nirilof" "org.qutebrowser.qutebrowser" "qutebrowser"]; "Super+Space".action.spawn = "cosmic-launcher"; + "Super+Alt+Space".action.spawn = ["rofi" "-no-lazy-grab" "-modi" "combi" "-show" "combi" "-combi-modi" "'drun,run'"]; + # "Super+Space".action.spawn = "rofi -i -show window"; "Super+V".action= spawn ["${pkgs.fish}/bin/fish" "-c" "${pkgs.cliphist}/bin/cliphist list | ${pkgs.rofi-wayland}/bin/rofi -p '󱃔 ' -dmenu | ${pkgs.cliphist}/bin/cliphist decode | ${pkgs.wl-clipboard}/bin/wl-copy"]; "Super+I".action.spawn = ["alacritty" "--class" "btm" "-e" "btm"]; "Super+A".action.spawn = ["alacritty" "--class" "pulsemixer" "-e" "pulsemixer"]; @@ -80,11 +111,15 @@ in "Super+C".action = close-window; "Super+Shift+C".action = center-window; "Super+P".action.spawn = "/home/chris/bin/rbw.sh"; - "Super+Left".action = focus-column-left; - "Super+H".action = focus-column-left; + "Super+Up".action = focus-window-or-monitor-up; + "Super+K".action = focus-window-or-monitor-up; + "Super+Down".action = focus-window-or-monitor-down; + "Super+J".action = focus-window-or-monitor-down; + "Super+Left".action = focus-column-or-monitor-left; + "Super+H".action = focus-column-or-monitor-left; "Super+Shift+H".action = move-column-left; - "Super+Right".action = focus-column-right; - "Super+L".action = focus-column-right; + "Super+Right".action = focus-column-or-monitor-right; + "Super+L".action = focus-column-or-monitor-right; "Super+Shift+L".action = move-column-right; "Super+Ctrl+L".action = set-column-width "+10%"; "Super+Ctrl+H".action = set-column-width "-10%"; @@ -92,19 +127,26 @@ in "Super+W".action = switch-preset-column-width; "Super+Comma".action = consume-or-expel-window-left; "Super+Period".action = consume-or-expel-window-right; + "Super+Alt+L".action = focus-monitor-right; + "Super+Alt+H".action = focus-monitor-left; }; spawn-at-startup = [ + { argv = ["dbus-update-activation-environment --systemd --all"]; } { argv = ["${pkgs.xwayland-satellite}/bin/xwayland-satellite"]; } { argv = ["waybar"]; } { argv = ["cosmic-osd"]; } - { argv = ["kwalled6"]; } + { argv = ["cosmic-idle"]; } + { argv = ["cosmic-settings-daemon"]; } + { argv = ["kwalletd6"]; } { argv = ["swww-daemon"]; } + { argv = ["systemctl --user start jellyfin-mpv-shim"]; } + { argv = ["systemctl --user start nextcloud-client"]; } + { argv = ["systemctl --user start syncthingtray"]; } { argv = ["rbw-agent"]; } { argv = ["/usr/lib/kdeconnectd"]; } { argv = ["kdeconnect-indicator"]; } { argv = ["wl-paste --watch cliphist store"]; } { argv = ["swww img /home/chris/pics/wallpapers/tech.jpg --resize crop -t grow --transition-bezier .14,0,.14,.99"]; } - { argv = ["dbus-update-activation-environment --systemd --all"]; } ]; workspaces = { "main" = { @@ -114,10 +156,10 @@ in window-rules = [ { geometry-corner-radius = { - top-left = 16.0; - top-right = 16.0; - bottom-left = 16.0; - bottom-right = 16.0; + top-left = 14.0; + top-right = 14.0; + bottom-left = 14.0; + bottom-right = 14.0; }; clip-to-geometry = true; draw-border-with-background = false; @@ -130,6 +172,11 @@ in matches = [{app-id = "org.qutebrowser.qutebrowser";}]; open-on-workspace = "main"; } + { + matches = [{app-id = "mpv";}]; + open-on-workspace = "main"; + open-on-output = "DP-1"; + } { matches = [{app-id = "com.system76.CosmicFiles";}]; open-floating = true; @@ -147,6 +194,7 @@ in ]; layout = { center-focused-column = "never"; + always-center-single-column = true; preset-column-widths = [ { proportion = 1. / 3.; } { proportion = 1. / 2.; } @@ -186,15 +234,50 @@ in theme = "phinger-cursors-light"; }; outputs = { - "eDP-1" = { + "laptop" = { enable = true; - name = "A"; + name = "eDP-1"; mode = { height = 1504; width = 2256; refresh = 60.0; }; }; + "desktop-center" = { + enable = true; + name = "DP-1"; + scale = 1.5; + position.x = 1080; + position.y = 0; + mode = { + height = 2160; + width = 3640; + refresh = 60.0; + }; + }; + "desktop-right" = { + enable = true; + name = "DP-2"; + position.x = 3640; + position.y = 0; + mode = { + height = 900; + width = 1600; + refresh = 59.94600; + }; + }; + "desktop-left" = { + enable = true; + name = "HDMI-A-1"; + transform.rotation = 90; + position.x = 0; + position.y = 0; + mode = { + height = 1080; + width = 1920; + refresh = 60.0; + }; + }; }; input = { mod-key = "Super"; @@ -206,7 +289,7 @@ in }; keyboard = { repeat-delay = 180; - repeat-rate = 180; + repeat-rate = 240; }; warp-mouse-to-focus = { enable = true;