commit 243114f554e32ecb21bf48da072bde6dd1bb4f83
parent dabded3e86e4035efabed9e550c2e6c6379eeb0f
Author: Divan Visagie <me@divanv.com>
Date: Fri, 27 Nov 2026 23:25:39 +0100
image: the first login creates the user's folders (ADR-0017)
Nothing created ~/.config/user-dirs.dirs, so the dirs crate returned no Pictures, Downloads and so
on: Settings did not list ~/Pictures/Wallpapers, and Files' sidebar places, avatars, Montage and
Mail use the same lookup. Fedora's xdg-user-dirs.service does the job but hangs on
graphical-session-pre.target, which Patina's session never reaches. The image now also wants it from
default.target, which every login reaches.
Tried in the test VM on the real image: with the link the unit runs (status 0) and the file and
the folders appear when the user's manager starts; without it they do not.
Diffstat:
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/docs/adr/0017-the-first-login-creates-the-users-folders.md b/docs/adr/0017-the-first-login-creates-the-users-folders.md
@@ -0,0 +1,38 @@
+# 0017. The first login creates the user's standard folders
+
+Date: 2026-11-27
+
+## Status
+
+Accepted (the user's direction: fix it in the image, so an update delivers it).
+
+## Context
+
+A machine installed from the ISO had `~/Pictures/Wallpapers` and Settings did not show it. Nothing had
+created `~/.config/user-dirs.dirs`, the file that tells apps where Pictures, Downloads and the rest
+are. Patina's apps ask the `dirs` crate (`dirs::picture_dir()` and the others), which returns nothing
+without that file: Settings skipped the folder and hid its "Open wallpapers folder" button, and Files'
+sidebar (Desktop, Documents, Downloads, Music, Pictures, Videos), Settings' avatars, Montage and Mail
+use the same lookup.
+
+Fedora does ship the fix: `xdg-user-dirs.service`, a user unit that runs `xdg-user-dirs-update`, enabled
+by preset. But it hangs on `graphical-session-pre.target`, which only a full desktop session (GNOME's)
+starts. Patina's session does not reach any `graphical-session*` target, so the unit never ran.
+
+## Decision
+
+- The image also wants `xdg-user-dirs.service` from `default.target`, which every login reaches
+ (`/usr/lib/systemd/user/default.target.wants/xdg-user-dirs.service`, a symlink in `linux/system/`).
+ The first login of a user creates the folders and the file; it is harmless to repeat.
+- It reaches machines that are already installed through an update: the folders appear at the next login.
+
+Tried in the test VM: without the link the unit stays inactive and the file is missing; with it the
+file and the folders are created as soon as the user's manager starts.
+
+## Not done
+
+- Patina's apps could fall back to `~/Pictures` and the others when the lookup returns nothing (the
+ compositor's screenshot code already does). That would make them work on a machine whose file was
+ deleted. It is a change in patina-desktop.
+- Starting `graphical-session.target` from patina-session is the general fix for everything that
+ expects a systemd-managed session (XDG autostart, for one). It is larger and belongs in patina-desktop.
diff --git a/linux/system/usr/lib/systemd/user/default.target.wants/xdg-user-dirs.service b/linux/system/usr/lib/systemd/user/default.target.wants/xdg-user-dirs.service
@@ -0,0 +1 @@
+../xdg-user-dirs.service
+\ No newline at end of file