From 213fb53a2c8fad39aca7680b08dd4ab65c38726c Mon Sep 17 00:00:00 2001 From: duynguyen Date: Thu, 13 Aug 2026 23:14:35 +0700 Subject: [PATCH] feat: replace waybar/walker/swaylock/swaybg with noctalia shell --- flake.nix | 6 +- home/duynguyen/config/niri/config.kdl | 13 +- home/duynguyen/default.nix | 194 ++++++++++++++++++-------- 3 files changed, 142 insertions(+), 71 deletions(-) diff --git a/flake.nix b/flake.nix index ec85d15..5c07246 100644 --- a/flake.nix +++ b/flake.nix @@ -17,9 +17,12 @@ inputs.nixpkgs.follows = "nixpkgs"; }; claude-desktop.url = "github:k3d3/claude-desktop-linux-flake"; + # Noctalia: Wayland shell for Niri (bar, launcher, lock, wallpaper, idle) + # Uses its own pinned nixpkgs (needs unstable deps) + noctalia.url = "github:noctalia-dev/noctalia-shell"; }; - outputs = { self, nixpkgs, home-manager, plasma-manager, zen-browser, claude-desktop, ... }: { + outputs = { self, nixpkgs, home-manager, plasma-manager, zen-browser, claude-desktop, noctalia, ... }@inputs: { nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ @@ -34,6 +37,7 @@ ]; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit inputs; }; home-manager.sharedModules = [ plasma-manager.homeModules.plasma-manager ]; home-manager.users.duynguyen = import ./home/duynguyen/default.nix; } diff --git a/home/duynguyen/config/niri/config.kdl b/home/duynguyen/config/niri/config.kdl index 943d1d5..c86e782 100644 --- a/home/duynguyen/config/niri/config.kdl +++ b/home/duynguyen/config/niri/config.kdl @@ -80,12 +80,8 @@ layout { } } -spawn-at-startup "waybar" +spawn-at-startup "noctalia" spawn-at-startup "xwayland-satellite" -spawn-at-startup "mako" -spawn-at-startup "elephant" -spawn-at-startup "sh" "-c" "walker --gapplication-service" -spawn-at-startup "start-wallpaper" hotkey-overlay { skip-at-startup @@ -132,9 +128,10 @@ window-rule { binds { Mod+Shift+Slash { show-hotkey-overlay; } - Mod+T hotkey-overlay-title="Open a Terminal: kitty" { spawn "kitty"; } - Mod+Space hotkey-overlay-title="Run an Application: walker" { spawn "walker"; } - Super+Alt+L hotkey-overlay-title="Lock the Screen: swaylock" { spawn "swaylock"; } + Mod+T hotkey-overlay-title="Open a Terminal: kitty" { spawn "kitty"; } + Mod+Space hotkey-overlay-title="Noctalia: Launcher" { spawn "noctalia-ipc" "panel-toggle" "launcher"; } + Mod+S hotkey-overlay-title="Noctalia: Control Center" { spawn "noctalia-ipc" "panel-toggle" "control-center"; } + Super+Alt+L hotkey-overlay-title="Noctalia: Lock" { spawn "noctalia-ipc" "session" "lock"; } XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+ -l 1.0"; } XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; } diff --git a/home/duynguyen/default.nix b/home/duynguyen/default.nix index 616c8a7..102f45b 100644 --- a/home/duynguyen/default.nix +++ b/home/duynguyen/default.nix @@ -1,17 +1,21 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, inputs, ... }: let - # Picks the first image from ~/.config/wallpapers and sets it via swaybg. - # Add images to home/duynguyen/wallpapers/ in the config repo and rebuild. - startWallpaper = pkgs.writeShellScriptBin "start-wallpaper" '' - f=$(find "$HOME/.config/wallpapers" -maxdepth 1 -type f \ - \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" \ - -o -name "*.gif" -o -name "*.webp" -o -name "*.avif" \) \ - | sort | head -1) - [ -n "$f" ] && exec ${pkgs.swaybg}/bin/swaybg -i "$f" -m fill + wallpaperDir = "${config.home.homeDirectory}/.config/wallpapers"; + defaultWallpaper = "${wallpaperDir}/even-in-arcadia.png"; + + # Thin wrapper so niri keybinds can call noctalia msg + # without hard-coding the nix-store path. + noctaliaIpc = pkgs.writeShellScriptBin "noctalia-ipc" '' + set -eu + exec noctalia msg "$@" ''; in { + imports = [ + inputs.noctalia.homeModules.default + ]; + home.username = "duynguyen"; home.homeDirectory = "/home/duynguyen"; home.stateVersion = "26.05"; @@ -21,6 +25,8 @@ in fonts.fontconfig.enable = false; home.packages = with pkgs; [ + noctaliaIpc + # Browsers zen-browser claude-desktop @@ -28,22 +34,15 @@ in # Terminals ghostty kitty - foot # lightweight, good default for Niri + foot # Niri supporting tools - startWallpaper # picks wallpaper from ~/.config/wallpapers and runs swaybg - walker # app launcher - elephant # modular data provider for walker - fuzzel # app launcher (alternative) - waybar - mako # notifications - wl-clipboard # copy/paste in Wayland terminal - swaylock # screen locker - swayidle # idle management - swaybg # wallpaper setter xwayland-satellite # X11 app support in Niri - xdg-utils # xdg-open, file associations - inotify-tools # filesystem event tools + xdg-utils # xdg-open, file associations + inotify-tools # filesystem event tools + + # Polkit agent for Niri session (graphical auth dialogs) + kdePackages.polkit-kde-agent-1 # Editor vscodium @@ -53,22 +52,23 @@ in imv gimp obs-studio - zathura # PDF viewer - thunar # file manager - xfce.thunar-archive-plugin # right-click archive operations - xfce.tumbler # thumbnail service - ffmpegthumbnailer # video thumbnails - xarchiver # archive manager GUI - grim # Wayland screenshot - slurp # region selector for grim - swappy # screenshot annotation + zathura + thunar + xfce.thunar-archive-plugin + xfce.tumbler + ffmpegthumbnailer + xarchiver + grim + slurp + swappy libreoffice telegram-desktop - pavucontrol # audio GUI - blueman # Bluetooth GUI + pavucontrol + blueman # Clipboard - cliphist # clipboard history (pairs with wl-clipboard) + cliphist + wl-clipboard # CLI tools vim @@ -77,23 +77,23 @@ in fastfetch btop ripgrep - fd # fast find alternative + fd fzf - eza # modern ls - bat # modern cat - dust # intuitive disk usage - jq # JSON processing - yq # YAML processing - shellcheck # shell script linter + eza + bat + dust + jq + yq + shellcheck ffmpeg imagemagick unzip p7zip - wiremix # TUI PipeWire audio mixer + wiremix # System control - brightnessctl # brightness keys - playerctl # media keys + brightnessctl + playerctl # Dev tools gh @@ -104,24 +104,93 @@ in home.sessionVariables.NIXOS_OZONE_WL = "1"; # Wallpapers folder — add images to home/duynguyen/wallpapers/ in the repo - # and rebuild; swaybg will pick the first one alphabetically + # and rebuild; noctalia reads from ~/.config/wallpapers xdg.configFile."wallpapers".source = ./wallpapers; + # Polkit agent as a systemd user service so it starts with the Niri session + systemd.user.services.polkit-kde-agent = { + Unit = { + Description = "KDE Polkit Authentication Agent"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = "${pkgs.kdePackages.polkit-kde-agent-1}/libexec/polkit-kde-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + }; + Install.WantedBy = [ "graphical-session.target" ]; + }; + + # ── Noctalia ────────────────────────────────────────────────────────────── + # Replaces: waybar, walker, swaylock, swaybg, swayidle, mako + programs.noctalia = { + enable = true; + settings = { + bar.default = { + start = [ "launcher" "clipboard" "cpu" "network" "ram" ]; + center = [ "clock" ]; + end = [ "notifications" "volume" "brightness" "battery" "control-center" "session" ]; + thickness = 40; + padding = 10; + radius = 0; + margin_edge = 0; + margin_ends = 0; + widget_spacing = 8; + }; + + idle = { + behavior_order = [ "lock" "screen-off" ]; + behavior = { + lock = { + action = "lock"; + enabled = true; + timeout = 600; # 10 min + }; + screen-off = { + action = "screen_off"; + enabled = true; + timeout = 660; + }; + }; + }; + + lockscreen.wallpaper = defaultWallpaper; + + nightlight.enabled = true; + + osd.position = "top_right"; + + shell = { + font_family = "JetBrainsMono Nerd Font"; + polkit_agent = true; + corner_radius_scale = 0.0; + animation.speed = 1.5; + panel = { + clipboard_placement = "attached"; + launcher_placement = "attached"; + launcher_session_search = true; + }; + shadow.alpha = 0.5; + }; + + theme.builtin = "Kanagawa"; + + wallpaper = { + enabled = true; + directory = wallpaperDir; + default.path = defaultWallpaper; + }; + }; + }; + + # ── Shell ───────────────────────────────────────────────────────────────── programs.zsh = { enable = true; autosuggestion.enable = true; syntaxHighlighting.enable = true; }; - programs.waybar = { - enable = true; - style = builtins.readFile ./config/waybar/style.css; - }; - - # Write config directly to avoid home-manager's waybar settings type - # conflicting with the `modules` key used by the group/drawer widget - xdg.configFile."waybar/config".source = ./config/waybar/config.json; - programs.kitty = { enable = true; settings.wheel_scroll_multiplier = 10; @@ -137,28 +206,28 @@ in programs.git = { enable = true; settings.user = { - name = "duynguyen"; + name = "duynguyen"; email = "huonghaiduynhim@gmail.com"; }; }; + # ── KDE Plasma (for the Plasma session; dark theme + touchpad) ──────────── programs.plasma = { enable = true; workspace.lookAndFeel = "org.kde.breezedark.desktop"; input.touchpads = [ { - name = "SynPS/2 Synaptics TouchPad"; - vendorId = "2"; - productId = "7"; + name = "SynPS/2 Synaptics TouchPad"; + vendorId = "2"; + productId = "7"; naturalScroll = true; - pointerSpeed = 0.4; - scrollSpeed = 0.75; + pointerSpeed = 0.4; + scrollSpeed = 0.75; } ]; }; - # Zen Browser scroll speed — written to all profiles via activation script - # so it works even if the profile ID changes on a fresh install + # ── Zen Browser scroll speed ────────────────────────────────────────────── home.activation.zenBrowserUserJs = lib.hm.dag.entryAfter [ "writeBoundary" ] '' for profile in "$HOME/.config/zen/"*.*/; do [[ -d "$profile" ]] || continue @@ -166,6 +235,7 @@ in done ''; + # ── Niri config ─────────────────────────────────────────────────────────── xdg.configFile."niri/config.kdl".source = pkgs.runCommand "niri-config-checked" { nativeBuildInputs = [ pkgs.niri ]; }