Commit 1f52ad2

HPCesia <me@hpcesia.com>
2025-10-09 06:29:38
fix: theme in niri
1 parent 8bb748a
Changed files (8)
modules
modules/desktop/apps/browser/firefox.nix
@@ -3,19 +3,26 @@
     pkgs,
     osConfig,
     ...
-  }: {
+  }: let
+    isPlasma =
+      pkgs.stdenv.hostPlatform.isLinux
+      && osConfig.services.desktopManager.plasma6.enable;
+    isNiri = osConfig.programs.niri.enable;
+  in {
     catppuccin.firefox.profiles.default.enable = false;
 
-    programs.firefox = let
-      isPlasma =
-        pkgs.stdenv.hostPlatform.isLinux
-        && osConfig.services.desktopManager.plasma6.enable;
-    in {
+    home.packages = lib.optionals isNiri [pkgs.pywalfox-native];
+
+    programs.firefox = {
       enable = true;
       languagePacks = ["zh-CN" "en-US"];
-      nativeMessagingHosts = lib.mkIf isPlasma (with pkgs; [
-        kdePackages.plasma-browser-integration
-      ]);
+      nativeMessagingHosts =
+        (lib.optionals isPlasma [
+          pkgs.kdePackages.plasma-browser-integration
+        ])
+        ++ (lib.optionals isNiri [
+          pkgs.pywalfox-native
+        ]);
 
       policies = {
         DisableAppUpdate = true;
@@ -51,12 +58,19 @@
             tampermonkey
             rsshub-radar
             aria2-integration
-            firefox-color
           ])
-          ++ lib.optionals isPlasma
-          (with pkgs.nur.repos.rycee.firefox-addons; [
-            plasma-integration
-          ]);
+          ++ (lib.optionals isPlasma
+            (with pkgs.nur.repos.rycee.firefox-addons; [
+              plasma-integration
+            ]))
+          ++ (lib.optionals isNiri
+            (with pkgs.nur.repos.rycee.firefox-addons; [
+              pywalfox
+            ]))
+          ++ (lib.optionals (!isNiri)
+            (with pkgs.nur.repos.rycee.firefox-addons; [
+              firefox-color
+            ]));
         settings = {
           # No First Run
           "app.normandy.first_run" = false;
modules/desktop/apps/terminal/ghostty/default.nix
@@ -1,5 +1,5 @@
-{
-  flake.modules.homeManager.terminal-ghostty = _: {
+{lib, ...}: {
+  flake.modules.homeManager.terminal-ghostty = {osConfig, ...}: {
     programs.ghostty = {
       enable = true;
       enableBashIntegration = true;
@@ -12,6 +12,7 @@
         window-height = 32;
         window-width = 128;
         window-new-tab-position = "current";
+        window-decoration = lib.mkIf osConfig.programs.niri.enable "none";
         copy-on-select = false;
         font-family = "Maple Mono CN";
       };
modules/desktop/apps/thunderbird/bird-tray.nix
@@ -2,6 +2,7 @@
   flake.modules.homeManager.desktop = {
     pkgs,
     config,
+    osConfig,
     ...
   }: let
     getThunderbirdAccountPath = accountName: profileName: let
@@ -11,8 +12,10 @@
     thunderbird-x = pkgs.thunderbird.overrideAttrs (oldAttrs: {
       makeWrapperArgs = oldAttrs.makeWrapperArgs ++ ["--set" "MOZ_ENABLE_WAYLAND" "0"];
     });
+
+    isNiri = osConfig.programs.niri.enable;
   in
-    lib.mkIf pkgs.stdenv.hostPlatform.isLinux {
+    lib.mkIf (pkgs.stdenv.hostPlatform.isLinux && !isNiri) {
       programs.thunderbird.package = thunderbird-x;
 
       home.packages = with pkgs; [
modules/desktop/shell/niri/appearance/default.nix
@@ -0,0 +1,7 @@
+{
+  flake.modules.homeManger.niri = _: {
+    programs.niri.settings = {
+      prefer-no-csd = true;
+    };
+  };
+}
modules/desktop/shell/niri/appearance/theme.nix
@@ -0,0 +1,47 @@
+{lib, ...}: {
+  flake.modules.homeManager.niri = {
+    pkgs,
+    config,
+    ...
+  }: let
+    whitesur-icon-theme = pkgs.whitesur-icon-theme.override {
+      boldPanelIcons = true;
+      alternativeIcons = true;
+    };
+  in {
+    catppuccin.kvantum.enable = false;
+
+    home.packages = [pkgs.colloid-gtk-theme];
+
+    gtk = {
+      enable = true;
+      gtk2.enable = false;
+      iconTheme = lib.mkForce {
+        name = "WhiteSur";
+        package = whitesur-icon-theme;
+      };
+    };
+
+    qt = {
+      enable = true;
+      platformTheme = {
+        name = "gtk3";
+      };
+    };
+
+    xdg.configFile = {
+      "gtk-4.0/gtk.css".enable = lib.mkForce false;
+      "gtk-3.0/gtk.css".enable = lib.mkForce false;
+      "gtk-4.0/settings.ini".enable = lib.mkForce false;
+      "gtk-3.0/settings.ini".enable = lib.mkForce false;
+    };
+
+    home.sessionVariables = {
+      XDG_ICON_DIR = "${whitesur-icon-theme}/share/icons/WhiteSur";
+    };
+
+    programs.dankMaterialShell.settings = {
+      currentThemeName = "cat-${config.catppuccin.accent}";
+    };
+  };
+}
modules/desktop/shell/niri/appearance/window-rules.nix
@@ -0,0 +1,11 @@
+{lib, ...}: {
+  flake.modules.homeManager.niri = _: {
+    programs.niri.settings.window-rules = [
+      # Corner radius for all windows
+      {
+        clip-to-geometry = true;
+        geometry-corner-radius = lib.genAttrs ["bottom-left" "bottom-right" "top-left" "top-right"] (_: 15.0);
+      }
+    ];
+  };
+}
modules/desktop/shell/niri/greeter.nix
@@ -1,5 +1,9 @@
-{
-  flake.modules.nixos.niri = {pkgs, ...}: {
+{inputs, ...}: {
+  flake.modules.nixos.niri = {
+    pkgs,
+    config,
+    ...
+  }: {
     programs.regreet = {
       enable = true;
       font.size = 22;
@@ -7,14 +11,20 @@
         package = pkgs.catppuccin-gtk.override {
           variant = "macchiato";
           size = "compact";
-          accents = ["mauve"];
+          accents = [config.catppuccin.accent];
         };
-        name = "catppuccin-macchiato-mauve-compact";
+        name = "catppuccin-macchiato-${config.catppuccin.accent}-compact";
       };
       cursorTheme = {
         package = pkgs.bibata-cursors;
         name = "Bibata-Modern-Classic";
       };
+      settings = {
+        background = {
+          path = "${inputs.wallpapers}/Nahida-1.jpg";
+          fit = "Cover";
+        };
+      };
     };
   };
 }
modules/desktop/shell/niri/theme.nix
@@ -1,20 +0,0 @@
-{
-  flake.modules.homeManager.niri = {pkgs, ...}: {
-    gtk = {
-      enable = true;
-      theme = {
-        name = "Colloid";
-        package = pkgs.colloid-gtk-theme;
-      };
-    };
-
-    catppuccin.kvantum.enable = false;
-    qt = {
-      enable = true;
-      platformTheme = {
-        name = "qt6ct";
-        package = pkgs.kdePackages.qt6ct;
-      };
-    };
-  };
-}