···6677- `wallpaper.jpg` — default desktop background and lock screen
8899-## Usage
99+## How it works
10101111-The wallpaper is referenced directly in `settings/plasma/default.nix`:
1111+### Linux (KDE Plasma)
1212+1313+plasma-manager's `workspace.wallpaper` option applies wallpaper via D-Bus at
1414+home-manager activation time. However, activation runs *before* the Plasma
1515+session is live, so D-Bus isn't available and it silently fails.
1616+1717+Instead, a `systemd.user` service in `home/programs/kde.nix` calls
1818+`plasma-apply-wallpaperimage` *after* `plasma-plasmashell.service` is up:
12191320```nix
1414-workspace = {
1515- wallpaper = "${../../wallpapers/wallpaper.jpg}";
1616- # ... other settings
2121+systemd.user.services.set-plasma-wallpaper = {
2222+ Unit.After = [ "plasma-plasmashell.service" ];
2323+ Unit.PartOf = [ "graphical-session.target" ];
2424+ Service.Type = "oneshot";
2525+ Service.ExecStart = "${pkgs.kdePackages.plasma-workspace}/bin/plasma-apply-wallpaperimage ${wallpaper}";
2626+ Install.WantedBy = [ "graphical-session.target" ];
1727};
1828```
19292020-Note: The string interpolation `"${...}"` is required to convert the path to a Nix store path string.
3030+### macOS
21312222-Applied automatically on every Home Manager rebuild.
3232+Applied via `programs.desktoppr` in `home/home.nix`.
23332434## Changing the Wallpaper
253526361. Replace `wallpapers/wallpaper.jpg` with your image (keep the same filename), or
2727-2. Add a new image and update the path in `settings/plasma/default.nix`
3737+2. Add a new image and update the `wallpaper` let-binding in `home/programs/kde.nix`
28383. Rebuild: `sudo nixos-rebuild switch --flake .#laptop`
3939+4040+The service will apply the new wallpaper on next login (or you can restart it manually):
4141+```bash
4242+systemctl --user restart set-plasma-wallpaper.service
4343+```
29443045## Recommended Format
3146
+30-2
home/programs/kde.nix
···11# KDE Plasma desktop settings — desktop hosts only (not server).
22# Terminal profile lives in terminal.nix and is imported separately for all
33-# non-Darwin hosts; this file is only the plasma-manager layer.
44-{ lib, cfgLib, ... }:
33+# non-Darwin hosts; this file is the plasma-manager layer + wallpaper service.
44+#
55+# Why a systemd service for wallpaper?
66+# plasma-manager applies the wallpaper via D-Bus at home-manager activation
77+# time. Activation runs before the Plasma session is live (no D-Bus), so it
88+# silently fails. The service below runs plasma-apply-wallpaperimage *after*
99+# the graphical session has started, which is the only reliable method.
1010+{ pkgs, lib, ... }:
5111212+let
1313+ wallpaper = "${../../wallpapers/wallpaper.jpg}";
1414+in
615{
716 imports = [
817 ../../settings/plasma
918 ];
1919+2020+ # ── Wallpaper systemd user service ─────────────────────────────────────────
2121+ systemd.user.services.set-plasma-wallpaper = {
2222+ Unit = {
2323+ Description = "Apply KDE Plasma wallpaper";
2424+ After = [ "plasma-plasmashell.service" ];
2525+ PartOf = [ "graphical-session.target" ];
2626+ };
2727+ Service = {
2828+ Type = "oneshot";
2929+ ExecStart = "${pkgs.kdePackages.plasma-workspace}/bin/plasma-apply-wallpaperimage ${wallpaper}";
3030+ # Restart on failure in case plasmashell wasn't fully ready yet
3131+ Restart = "on-failure";
3232+ RestartSec = "2s";
3333+ };
3434+ Install = {
3535+ WantedBy = [ "graphical-session.target" ];
3636+ };
3737+ };
1038}
+1-4
settings/plasma/default.nix
···99#
1010# All font families, sizes, color schemes, and icon themes come from
1111# settings/config/desktop.nix — never hardcoded here.
1212-# Wallpaper lives in ../../wallpapers/wallpaper.jpg.
1212+# Wallpaper is applied by a systemd user service in home/programs/kde.nix.
1313# The Konsole profile lives in home/programs/terminal.nix.
1414#
1515# macOS-like layout:
···136136137137 # ── Workspace ─────────────────────────────────────────────────────────────
138138 workspace = {
139139-140140- # Wallpaper — direct path to wallpaper.jpg (must be string-interpolated).
141141- wallpaper = "${../../wallpapers/wallpaper.jpg}";
142139143140 # Color scheme — from settings/config/desktop.nix.
144141 # Explicit here so it always wins, even if the catppuccin module changes