Commit d50854e

HPCesia <me@hpcesia.com>
2025-10-11 16:45:55
feat: switch to nocatalia shell
Because it's nix module is more powerful.
1 parent b8b58e3
modules/desktop/shell/niri/appearance/dms.nix
@@ -1,23 +0,0 @@
-{inputs, ...}: {
-  flake.modules.homeManager.niri = {config, ...}: {
-    programs.dankMaterialShell = {
-      settings = {
-        currentThemeName = "cat-${config.catppuccin.accent}";
-
-        dankBarTransparency = 0.95;
-        dankBarWidgetTransparency = 0.85;
-        dankBarGothCornersEnabled = true;
-        dankBarSquareCorners = true;
-        dankBarSpacing = 0;
-        cornerRadius = 15;
-        popupTransparency = 0.95;
-
-        fontScale = 1.1;
-      };
-      wallpaper = {
-        enable = true;
-        path = "${inputs.wallpapers}/default_wallpaper";
-      };
-    };
-  };
-}
modules/desktop/shell/niri/appearance/layer-rules.nix
@@ -2,7 +2,7 @@
   flake.modules.homeManager.niri = _: {
     programs.niri.settings.layer-rules = [
       {
-        matches = [{namespace = "^quickshell$";}];
+        matches = [{namespace = "^quickshell-overview$";}];
         place-within-backdrop = true;
       }
     ];
modules/desktop/shell/niri/appearance/theme.nix
@@ -42,5 +42,46 @@
     home.sessionVariables = {
       XDG_ICON_DIR = "${whitesur-icon-theme}/share/icons/WhiteSur";
     };
+
+    programs.noctalia-shell.colors = let
+      mocchiato = {
+        rosewater = "#f4dbd6";
+        flamingo = "#f0c6c6";
+        pink = "#f5bde6";
+        mauve = "#c6a0f6";
+        red = "#ed8796";
+        maroon = "#ee99a0";
+        peach = "#f5a97f";
+        yellow = "#eed49f";
+        green = "#a6da95";
+        teal = "#8bd5ca";
+        sky = "#91d7e3";
+        sapphire = "#7dc4e4";
+        blue = "#8aadf4";
+        lavender = "#b7bdf8";
+
+        text = "#cad3f5";
+        subtext0 = "#a5adcb";
+        overlay0 = "#6e738d";
+        surface0 = "#363a4f";
+        base = "#24273a";
+        crust = "#181926";
+      };
+    in {
+      mPrimary = mocchiato.${config.catppuccin.accent};
+      mOnPrimary = mocchiato.crust;
+      mSecondary = mocchiato.peach;
+      mOnSecondary = mocchiato.crust;
+      mTertiary = mocchiato.lavender;
+      mOnTertiary = mocchiato.crust;
+      mError = mocchiato.red;
+      mOnError = mocchiato.crust;
+      mSurface = mocchiato.base;
+      mOnSurface = mocchiato.text;
+      mSurfaceVariant = mocchiato.surface0;
+      mOnSurfaceVariant = mocchiato.subtext0;
+      mOutline = mocchiato.overlay0;
+      mShadow = mocchiato.crust;
+    };
   };
 }
modules/desktop/shell/niri/default.nix
@@ -1,23 +1,26 @@
 {inputs, ...}: {
   flake.modules.nixos.niri = _: {
-    imports = [inputs.niri-flake.nixosModules.niri];
+    imports = [
+      inputs.niri-flake.nixosModules.niri
+      inputs.noctalia.nixosModules.default
+    ];
 
     niri-flake.cache.enable = false;
 
     programs.niri = {
       enable = true;
     };
+
+    services.noctalia-shell.enable = true;
   };
 
   flake.modules.homeManager.niri = _: {
     imports = [
-      inputs.dankMaterialShell.homeModules.dankMaterialShell.default
-      inputs.dankMaterialShell.homeModules.dankMaterialShell.niri
+      inputs.noctalia.homeModules.default
     ];
 
-    programs.dankMaterialShell = {
+    programs.noctalia-shell = {
       enable = true;
-      niri = {enableSpawn = true;};
     };
   };
 }
modules/desktop/shell/niri/keybinding.nix
@@ -1,7 +1,7 @@
 {
   flake.modules.homeManager.niri = {config, ...}: {
     programs.niri.settings.binds = with config.lib.niri.actions; let
-      dms-ipc = spawn "dms" "ipc";
+      noctalia = spawn "noctalia-shell" "ipc" "call";
     in {
       # Mod-Shift-/, which is usually the same as Mod-?,
       # shows a list of important hotkeys.
@@ -19,39 +19,46 @@
       # === DankMaterialShell Actions ===
       # Partially copy from DMS' niri home manager module
       "Mod+Space" = {
-        action = dms-ipc "spotlight" "toggle";
+        action = noctalia "launcher" "toggle";
         hotkey-overlay.title = "Toggle Application Launcher";
       };
       "Super+Alt+L" = {
-        action = dms-ipc "lock" "lock";
+        action = noctalia "lockScreen" "toggle";
         hotkey-overlay.title = "Toggle Lock Screen";
       };
+      "Mod+Escape" = {
+        action = noctalia "settings" "toggle";
+        hotkey-overlay.title = "Toggle Settings Menu";
+      };
 
       "XF86AudioRaiseVolume" = {
         allow-when-locked = true;
-        action = dms-ipc "audio" "increment" "3";
+        action = noctalia "volume" "increase";
       };
       "XF86AudioLowerVolume" = {
         allow-when-locked = true;
-        action = dms-ipc "audio" "decrement" "3";
+        action = noctalia "volume" "decrease";
       };
       "XF86AudioMute" = {
         allow-when-locked = true;
-        action = dms-ipc "audio" "mute";
+        action = noctalia "volume" "muteOutput";
       };
       "XF86AudioMicMute" = {
         allow-when-locked = true;
-        action = dms-ipc "audio" "micmute";
+        action = noctalia "volume" "muteInput";
       };
+
       "XF86MonBrightnessUp" = {
         allow-when-locked = true;
-        action = dms-ipc "brightness" "increment" "5" "";
+        action = noctalia "brightness" "increase";
       };
       "XF86MonBrightnessDown" = {
         allow-when-locked = true;
-        action = dms-ipc "brightness" "decrement" "5" "";
+        action = noctalia "brightness" "decrease";
       };
 
+      "XF86Calculator".action = noctalia "launcher" "calculator";
+
       # === Window and Column Actions ===
       "Mod+Q".action = close-window;
 
modules/desktop/shell/niri/noctalia.nix
@@ -0,0 +1,73 @@
+{inputs, ...}: {
+  flake.modules.homeManager.niri = {config, ...}: {
+    programs.noctalia-shell = {
+      settings = {
+        general = {
+          avatarImage = "${config.home.homeDirectory}/.face";
+          radiusRatio = 0.75;
+          screenRadiusRatio = 0.5;
+        };
+        wallpaper = {
+          enabled = true;
+          directory = inputs.wallpapers;
+          defaultWallpaper = "${inputs.wallpapers}/default_wallpaper";
+        };
+        appLauncher = {
+          backgroundOpacity = 0.9;
+          enableClipboardHistory = true;
+          terminalCommand = "ghostty -e";
+        };
+        location.name = "重庆, 中国";
+        bar = {
+          backgroundOpacity = 0.9;
+          density = "comfortable";
+          floating = true;
+          marginHorizontal = 0.4;
+          marginVertical = 0.4;
+          widgets = {
+            center = [
+              {
+                id = "Workspace";
+                hideUnoccupied = true;
+                labelMode = "index";
+              }
+            ];
+            left = [
+              {id = "SystemMonitor";}
+              {id = "ActiveWindow";}
+              {
+                id = "MediaMini";
+                autoHide = true;
+              }
+            ];
+            right = [
+              {id = "ScreenRecorder";}
+              {
+                id = "Tray";
+                blacklist = ["Bluetooth *"]; # Bluetooth applets tend to be buggy
+              }
+              {
+                id = "NotificationHistory";
+                hideWhenZero = true;
+                showUnreadBadge = true;
+              }
+              {id = "Bluetooth";}
+              {id = "Volume";}
+              {id = "Brightness";}
+              {id = "Battery";}
+              {
+                id = "Clock";
+                formatHorizontal = "yyyy年M月d日 HH:mm";
+                formatVertical = "yyyy年M月d日 dddd-AP HH:mm:ss";
+              }
+              {
+                id = "ControlCenter";
+                useDistroLogo = true;
+              }
+            ];
+          };
+        };
+      };
+    };
+  };
+}
modules/desktop/shell/niri/options.nix
@@ -1,164 +0,0 @@
-{lib, ...}: {
-  flake.modules.homeManager.niri = {
-    config,
-    pkgs,
-    ...
-  }: let
-    inherit (lib) types mkOption;
-    format = pkgs.formats.json {};
-    cfg = config.programs.dankMaterialShell;
-
-    mergeConfigScript = config: target:
-      pkgs.writeShellApplication {
-        name = "dms-merge-config";
-        runtimeEnv = {
-          NEW_JSON = pkgs.writeText "config" (builtins.toJSON config);
-        };
-        runtimeInputs = with pkgs; [jq];
-        text = ''
-          set -eu
-
-          TARGET_FILE="${target}"
-          TARGET_DIR=$(dirname "$TARGET_FILE")
-
-          mkdir -p "$TARGET_DIR"
-
-          if [ -f "$TARGET_FILE" ]; then
-            echo "Merging config into existing file: $TARGET_FILE"
-            TEMP_FILE=$(mktemp)
-            jq --slurp '.[0] * .[1]' "$TARGET_FILE" "$NEW_JSON" > "$TEMP_FILE"
-            mv "$TEMP_FILE" "$TARGET_FILE"
-          else
-            echo "$TARGET_FILE not found. Creating new..."
-            echo "$NEW_JSON" > "$TARGET_FILE"
-          fi
-
-          echo "Config merge complete."
-        '';
-      };
-  in {
-    options.programs.dankMaterialShell = {
-      settings = mkOption {
-        type = types.nullOr (types.submodule {
-          freeformType = format.type;
-        });
-        default = null;
-      };
-      wallpaper = {
-        enable = lib.mkEnableOption "Enable wallpaper.";
-        path = mkOption {
-          type = types.oneOf [types.str types.path];
-          default = "";
-          description = "Path of wallpaper, could be path or hex color string";
-        };
-        perMode = {
-          enable = lib.mkEnableOption "Enable per mode wallpaper.";
-          light = mkOption {
-            type = types.oneOf [types.str types.path];
-            default = cfg.wallpaper.path;
-          };
-          dark = mkOption {
-            type = types.oneOf [types.str types.path];
-            default = cfg.wallpaper.path;
-          };
-        };
-        perMonitor = {
-          enable = lib.mkEnableOption "Enable per mode wallpaper.";
-          monitors = mkOption {
-            type = types.attrsOf (types.oneOf [types.str types.path]);
-            default = {};
-          };
-        };
-        cycling = {
-          enable = lib.mkEnableOption "Enable wallpaper cycling.";
-          mode = mkOption {
-            type = types.enum ["interval" "time"];
-            default = "interval";
-          };
-          interval = mkOption {
-            type = types.ints.unsigned;
-            default = 300;
-          };
-          time = mkOption {
-            type = types.str;
-            default = "06:00";
-          };
-        };
-        transition = {
-          name = mkOption {
-            type = types.enum [
-              "random"
-              "none"
-              "fade"
-              "wipe"
-              "disc"
-              "stripes"
-              "iris bloom"
-              "pixelate"
-              "portal"
-            ];
-            default = "fade";
-          };
-          include = mkOption {
-            type = types.listOf (types.enum ["fade" "wipe" "disc" "stripes" "iris bloom" "pixelate" "portal"]);
-            default = ["fade" "wipe" "disc" "stripes" "iris bloom" "pixelate" "portal"];
-          };
-        };
-      };
-    };
-
-    config = {
-      systemd.user.services.dank-material-shell-settings-setup = lib.mkIf (cfg.settings != null) {
-        Unit = {
-          Description = "DankMaterialShell Setup service";
-          After = ["graphical-session-pre.target"];
-          Wants = ["graphical-session-pre.target"];
-        };
-        Install.WantedBy = ["graphical-session.target"];
-        Service = {
-          Type = "oneshot";
-          UMask = "0022";
-          ExecStart = lib.getExe (
-            mergeConfigScript cfg.settings "${config.xdg.configHome}/DankMaterialShell/settings.json"
-          );
-        };
-      };
-
-      systemd.user.services.dank-material-shell-wallpaper-setup = let
-        wcfg = cfg.wallpaper;
-        mergedConfig = {
-          wallpaperPath = lib.optionalString wcfg.enable wcfg.path;
-
-          perMonitorWallpaper = wcfg.perMonitor.enable;
-          monitorWallpapers = wcfg.perMonitor.monitors;
-
-          perModeWallpaper = wcfg.perMode.enable;
-          wallpaperPathLight = wcfg.perMode.light;
-          wallpaperPathDark = wcfg.perMode.dark;
-
-          wallpaperCyclingEnabled = wcfg.cycling.enable;
-          wallpaperCyclingMode = wcfg.cycling.mode;
-          wallpaperCyclingInterval = wcfg.cycling.interval;
-          wallpaperCyclingTime = wcfg.cycling.time;
-
-          wallpaperTransition = wcfg.transition.name;
-          includedTransitions = wcfg.transition.include;
-        };
-      in {
-        Unit = {
-          Description = "DankMaterialShell Setup service";
-          After = ["graphical-session-pre.target"];
-          Wants = ["graphical-session-pre.target"];
-        };
-        Install.WantedBy = ["graphical-session.target"];
-        Service = {
-          Type = "oneshot";
-          UMask = "0022";
-          ExecStart = lib.getExe (
-            mergeConfigScript mergedConfig "${config.xdg.stateHome}/DankMaterialShell/session.json"
-          );
-        };
-      };
-    };
-  };
-}
modules/desktop/shell/niri/xdg-portal.nix
@@ -1,13 +1,17 @@
 {
-  flake.modules.nixos.niri = _: {
+  flake.modules.nixos.niri = {pkgs, ...}: {
     xdg.portal = {
       enable = true;
-
+      extraPortals = [
+        # Need for screen record
+        pkgs.xdg-desktop-portal-wlr
+      ];
       config = {
         common = {
           # Use xdg-desktop-portal-gtk for every portal interface...
           default = [
             "gtk"
+            "wlr"
           ];
           # except for the secret portal, which is handled by gnome-keyring
           "org.freedesktop.impl.portal.Secret" = [
flake.lock
@@ -33,29 +33,6 @@
         "type": "github"
       }
     },
-    "dankMaterialShell": {
-      "inputs": {
-        "dgop": "dgop",
-        "dms-cli": "dms-cli",
-        "nixpkgs": [
-          "nixpkgs"
-        ],
-        "quickshell": "quickshell"
-      },
-      "locked": {
-        "lastModified": 1760014899,
-        "narHash": "sha256-nFsmtITfHm/cK/9o0JO28VAbcRDYjknQDYo5mUm6iV0=",
-        "owner": "AvengeMedia",
-        "repo": "DankMaterialShell",
-        "rev": "5e2371c2cbc5a5c439065218ded993baf7ab8994",
-        "type": "github"
-      },
-      "original": {
-        "owner": "AvengeMedia",
-        "repo": "DankMaterialShell",
-        "type": "github"
-      }
-    },
     "deploy-rs": {
       "inputs": {
         "flake-compat": "flake-compat",
@@ -78,27 +55,6 @@
         "type": "github"
       }
     },
-    "dgop": {
-      "inputs": {
-        "nixpkgs": [
-          "dankMaterialShell",
-          "nixpkgs"
-        ]
-      },
-      "locked": {
-        "lastModified": 1759769087,
-        "narHash": "sha256-b4dEAjvIfIkw2/C47aZGDnwhTBEjqptDo8J5PizeTCo=",
-        "owner": "AvengeMedia",
-        "repo": "dgop",
-        "rev": "ad6ad285e8b882c41eb8994ef7c91e151afb9a97",
-        "type": "github"
-      },
-      "original": {
-        "owner": "AvengeMedia",
-        "repo": "dgop",
-        "type": "github"
-      }
-    },
     "disko": {
       "inputs": {
         "nixpkgs": [
@@ -139,27 +95,6 @@
         "type": "github"
       }
     },
-    "dms-cli": {
-      "inputs": {
-        "nixpkgs": [
-          "dankMaterialShell",
-          "nixpkgs"
-        ]
-      },
-      "locked": {
-        "lastModified": 1759946376,
-        "narHash": "sha256-/kQpJPH1y+U6V7N3bbGzvNRGfk9VuxdZev9Os4bS5ZQ=",
-        "owner": "AvengeMedia",
-        "repo": "danklinux",
-        "rev": "98db89ffba290265bc4a886d13b8a27a53fdaca1",
-        "type": "github"
-      },
-      "original": {
-        "owner": "AvengeMedia",
-        "repo": "danklinux",
-        "type": "github"
-      }
-    },
     "flake-compat": {
       "flake": false,
       "locked": {
@@ -550,6 +485,28 @@
         "type": "github"
       }
     },
+    "noctalia": {
+      "inputs": {
+        "nixpkgs": [
+          "nixpkgs"
+        ],
+        "quickshell": "quickshell",
+        "systems": "systems_3"
+      },
+      "locked": {
+        "lastModified": 1760200599,
+        "narHash": "sha256-h9VyfRmZtvPoyebLTChE67Wlxco7FadkauvWHmCTmZI=",
+        "owner": "noctalia-dev",
+        "repo": "noctalia-shell",
+        "rev": "c9729789a788ae266fce257fa08b49067362a6f5",
+        "type": "github"
+      },
+      "original": {
+        "owner": "noctalia-dev",
+        "repo": "noctalia-shell",
+        "type": "github"
+      }
+    },
     "nur": {
       "inputs": {
         "flake-parts": "flake-parts_2",
@@ -661,28 +618,27 @@
     "quickshell": {
       "inputs": {
         "nixpkgs": [
-          "dankMaterialShell",
+          "noctalia",
           "nixpkgs"
         ]
       },
       "locked": {
-        "lastModified": 1759610621,
-        "narHash": "sha256-P3UPFd95mS/3aNgy40nCXAmyfR2bEEBd+tX6xfkYFb0=",
+        "lastModified": 1753595452,
+        "narHash": "sha256-vqkSDvh7hWhPvNjMjEDV4KbSCv2jyl2Arh73ZXe274k=",
         "ref": "refs/heads/master",
-        "rev": "c5c438f1cd1a76660a8658ef929a3d19e968e2ce",
-        "revCount": 689,
+        "rev": "a5431dd02dc23d9ef1680e67777fed00fe5f7cda",
+        "revCount": 665,
         "type": "git",
-        "url": "https://git.outfoxxed.me/quickshell/quickshell"
+        "url": "https://git.outfoxxed.me/outfoxxed/quickshell"
       },
       "original": {
         "type": "git",
-        "url": "https://git.outfoxxed.me/quickshell/quickshell"
+        "url": "https://git.outfoxxed.me/outfoxxed/quickshell"
       }
     },
     "root": {
       "inputs": {
         "catppuccin": "catppuccin",
-        "dankMaterialShell": "dankMaterialShell",
         "deploy-rs": "deploy-rs",
         "disko": "disko",
         "distro-grub-themes": "distro-grub-themes",
@@ -696,6 +652,7 @@
         "nixpkgs": "nixpkgs_3",
         "nixpkgs-stable": "nixpkgs-stable_2",
         "nixpkgs-unstable": "nixpkgs-unstable",
+        "noctalia": "noctalia",
         "nur": "nur",
         "nur-hpcesia": "nur-hpcesia",
         "plasma-manager": "plasma-manager",
@@ -797,6 +754,21 @@
         "type": "github"
       }
     },
+    "systems_3": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    },
     "utils": {
       "inputs": {
         "systems": "systems"
flake.nix
@@ -4,9 +4,6 @@
   inputs = {
     catppuccin.url = "github:catppuccin/nix";
 
-    dankMaterialShell.url = "github:AvengeMedia/DankMaterialShell";
-    dankMaterialShell.inputs.nixpkgs.follows = "nixpkgs";
-
     deploy-rs.url = "github:serokell/deploy-rs";
     deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
 
@@ -35,6 +32,9 @@
 
     nixos-hardware.url = "github:NixOS/nixos-hardware/master";
 
+    noctalia.url = "github:noctalia-dev/noctalia-shell";
+    noctalia.inputs.nixpkgs.follows = "nixpkgs";
+
     nur.url = "github:nix-community/NUR";
     nur.inputs.nixpkgs.follows = "nixpkgs";
 
README.md
@@ -8,7 +8,7 @@ My [Dendritic Pattern][dendritic-pattern] Nix configuration, for a NixOS laptop
 
 |                             | NixOS                                                        |
 | --------------------------- | ------------------------------------------------------------ |
-| **Desktop**                 | [Niri][niri] + [Dank Material Shell][dank-material-shell]    |
+| **Desktop**                 | [Niri][niri] + [Noctalia Shell][noctalia-shell]              |
 | **Terminal**                | [Ghostty][ghostty] + [Zellij][zellij]                        |
 | **Shell**                   | [Fish][fish] + [Starship][starship]                          |
 | **Input Method**            | [Fcitx5][fcitx5] + [Rime][rime] (using [rime-ice][rime-ice]) |
@@ -48,7 +48,6 @@ deploy .
 
 [catppuccin]: https://github.com/catppuccin/catppuccin
 [chromium]: https://chromium.googlesource.com/chromium/src
-[dank-material-shell]: https://github.com/AvengeMedia/DankMaterialShell
 [deadbeef]: https://github.com/DeaDBeeF-Player/deadbeef
 [dendritic-pattern]: https://github.com/mightyiam/dendritic
 [fcitx5]: https://github.com/fcitx/fcitx5
@@ -59,6 +58,7 @@ deploy .
 [mihomo]: https://github.com/MetaCubeX/mihomo
 [mpv]: https://github.com/mpv-player/mpv
 [niri]: https://github.com/YaLTeR/niri
+[noctalia-shell]: https://github.com/noctalia-dev/noctalia-shell
 [rime]: https://github.com/rime/librime
 [rime-ice]: https://github.com/iDvel/rime-ice
 [starship]: https://github.com/starship/starship
README.zh-CN.md
@@ -8,7 +8,7 @@
 
 |              | NixOS                                                       |
 | ------------ | ----------------------------------------------------------- |
-| **桌面**     | [Niri][niri] + [Dank Material Shell][dank-material-shell]   |
+| **桌面**     | [Niri][niri] + [Noctalia Shell][noctalia-shell]             |
 | **终端**     | [Ghostty][ghostty] + [Zellij][zellij]                       |
 | **Shell**    | [Fish][fish] + [Starship][starship]                         |
 | **输入法**   | [Fcitx5][fcitx5] + [Rime][rime] (使用 [rime-ice][rime-ice]) |
@@ -48,7 +48,6 @@ deploy .
 
 [catppuccin]: https://github.com/catppuccin/catppuccin
 [chromium]: https://chromium.googlesource.com/chromium/src
-[dank-material-shell]: https://github.com/AvengeMedia/DankMaterialShell
 [deadbeef]: https://github.com/DeaDBeeF-Player/deadbeef
 [dendritic-pattern]: https://github.com/mightyiam/dendritic
 [fcitx5]: https://github.com/fcitx/fcitx5
@@ -59,6 +58,7 @@ deploy .
 [mihomo]: https://github.com/MetaCubeX/mihomo
 [mpv]: https://github.com/mpv-player/mpv
 [niri]: https://github.com/YaLTeR/niri
+[noctalia-shell]: https://github.com/noctalia-dev/noctalia-shell
 [rime]: https://github.com/rime/librime
 [rime-ice]: https://github.com/iDvel/rime-ice
 [starship]: https://github.com/starship/starship