Skip to content

desktop_page(wallpaper): scan the pack registry, not just backgrounds paths - #24

Open
perlowja wants to merge 2 commits into
singularityos-lab:mainfrom
perlowja:fix/wallpaper-picker-pack-registry
Open

desktop_page(wallpaper): scan the pack registry, not just backgrounds paths#24
perlowja wants to merge 2 commits into
singularityos-lab:mainfrom
perlowja:fix/wallpaper-picker-pack-registry

Conversation

@perlowja

@perlowja perlowja commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

The wallpaper picker in Desktop settings has never shown any wallpapers — not the shipped NCZ art, not artist packs, not the Bing provider cache. Two bugs:

  • /usr/share/backgrounds holds no images directly, only subdirectories (ncz/, singularity/). A directory's content-type is inode/directory, so the old one-level scan silently skipped everything.
  • A pack can declare its own directory outside any backgrounds path (the Bing provider caches to /var/cache/ncz-wallpapers/bing), which the old fixed-path scan could never reach at all.

What changed

populate_grid() now reads every installed pack's .collection KeyFile for its Dir= entry (system dirs via XDG_DATA_DIRS, plus the per-user collections dir) and recursively walks each resulting scan root, bounded to depth 3, skipping symlinks (cycle prevention, and avoids double-listing default.jpg, which the rotator repoints at whichever wallpaper is current), deduping overlapping roots.

Scope note for review

Dir= values from the per-user collection dir ($XDG_DATA_HOME/ncz-wallpapers/collections) are trusted without a path-prefix check. This mirrors the existing shell-script registry (ncz-wallpaper-collections) that already treats the per-user dir as a legitimate pack-declaration tier — it's not a privilege boundary (same UID reading its own filesystem), and the design intentionally allows a pack's Dir to live anywhere (that's what makes the Bing cache reachable at all). But it does mean a .collection file dropped into that user-writable directory can point the picker at an arbitrary readable path and surface whatever images live there, recursively, up to depth 3. Flagging it explicitly rather than silently narrowing the feature — happy to add a path-prefix allowlist if you'd rather constrain per-user Dir to known roots.

Validation

Built clean in a debian:forky container (the documented isolation path — libgtk4-layer-shell-dev on Debian conflicts with NCZ's patched runtime lib): meson compile succeeded, all 5 targets linked including singularity-desktop. No new warnings introduced; existing deprecation warnings (Gtk.Widget.get_style_context, etc.) are pre-existing and untouched by this diff.

🤖 Generated with Claude Code

https://claude.ai/code/session_018Hn3H7xGPDu6W2ntjotqao

… paths

The picker enumerated a single level of a fixed backgrounds-path list and
kept only entries whose content-type began with image/. Two bugs in that:

- /usr/share/backgrounds contains no images directly, only ncz/ and
  singularity/ subdirectories -- a directory's content-type is
  inode/directory, so every shipped wallpaper was silently skipped and had
  never displayed in the picker.
- Packs that declare their own directory outside any backgrounds path are
  unreachable by walking backgrounds at all. The Bing provider caches into
  /var/cache/ncz-wallpapers/bing, which nothing in the old scan roots would
  ever reach.

Now reads every installed pack's .collection file for its Dir= entry (the
current on-disk registry format; docs/WALLPAPER-PACKS.md's move to
.pack.json should parse both when it lands, not replace this, or packs
from the older deb disappear from the picker on upgrade) and walks each
scan root recursively up to a bounded depth, skipping symlinks (both to
avoid directory cycles and to avoid double-listing default.jpg, which the
rotator repoints at whichever wallpaper is current) and avoiding re-walking
overlapping roots.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T22:42:18.340961Z 09d5ece PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 09d5ecea6e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// wallpaper is current. Its target is enumerated in the same
// directory, so following it would list one image twice --
// once under its own name and once as "default".
if (info.get_is_symlink()) continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve valid symlinked wallpapers

When a wallpaper package exposes an image through a symlink whose target is elsewhere, this unconditional check removes its only gallery entry. The previous scanner followed the link and accepted the target's image content type, so skipping every symlink—not just the same-directory default.jpg alias described above—regresses these installed wallpapers; restrict the exclusion to known duplicate aliases or deduplicate resolved targets instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed in 0adbc99 — only elide a symlinked file when its resolved target sits in the same directory being scanned (the actual default.jpg double-listing case); a symlink pointing to a target elsewhere is now followed and listed, matching the previous scanner's behavior of resolving content-type through the link.

…same-dir pointers

Codex review on PR singularityos-lab#24 caught a regression: the previous commit skipped
every symlinked file to avoid double-listing default.jpg, but that also
drops a pack's wallpaper if it ships one as a symlink to a shared asset
outside the scanned directory -- the old scanner followed those fine
(content-type resolves through the link). Only elide a symlink whose
target sits in the same directory being scanned, which is the actual
double-listing case.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Hn3H7xGPDu6W2ntjotqao
perlowja added a commit to perlowja/singularity-shell that referenced this pull request Sep 4, 2026
…ntrols

First of four plans implementing the wallpaper-pack-browser-ocs spec.
Covers spec sections 1 and 5 only. Branches from PR singularityos-lab#24
(fix/wallpaper-picker-pack-registry) since it extends that PR's
collection-registry scan.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Hn3H7xGPDu6W2ntjotqao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant