Repository navigation
[ryoku] dolphin: Set as Wallpaper through ryogami, add the picture to the library - #944
Conversation
neur0map
left a comment
There was a problem hiding this comment.
🔴 Changes requested — 0 critical and 1 major issue(s): see the inline comments and the walkthrough for fixes and an agent-ready prompt.
| [Desktop Entry] | ||
| Type=Service | ||
| MimeType=image/jpeg;image/png;image/webp;image/gif;image/bmp;image/avif;image/jxl;image/tiff; | ||
| Actions=setRyokuWallpaper; | ||
| X-KDE-Priority=TopLevel |
There was a problem hiding this comment.
🟡 minor · Possible Bug · fix: high effort
The service menu is installed system-wide without a desktop restriction, and the system default also hides Plasma's action. A user running a Plasma session on the same installation will therefore lose Plasma's working wallpaper action and be offered the Ryoku command instead. Scope both the replacement and the hide setting to Ryoku sessions.
Reply here to discuss, say it's fixed, or explain why it's intended — no mention needed.
There was a problem hiding this comment.
Agreed, this is real on a box with both sessions. I looked into it: KService does honour NotShowIn (so NotShowIn=KDE; could hide the Ryoku entry under Plasma), but the hide setting is the harder half. KConfig only reads kservicemenurc from XDG_CONFIG_HOME and XDG_CONFIG_DIRS, and nothing Ryoku-specific sits on that path: ryoku-wayland-session wraps Plasma's sessions too, 98-ryoku-dbus.conf applies to every systemd user session, and apps launched from compositor binds inherit the compositor's environment rather than ryoku-host session start's. Scoping it properly means a Ryoku-session-only XDG_CONFIG_DIRS entry (for example /usr/share/ryoku/xdg-config) prepended by each provider (Hyprland hl.env, niri environment {}, Wayfire's launcher), with the doctor and delivery checks following. That is a cross-provider change, so I'd rather not fold it into this PR. Happy to do it here or as a follow-up if you'd prefer; until then a Plasma user can turn Plasma's action back on in Dolphin > Configure > Context Menu, which overrides the system default.
There was a problem hiding this comment.
Please address this in the PR, or leave the system-wide menu and hide setting out until session scoping is ready. The current entry has no desktop restriction, and asking Plasma users to restore their action manually leaves the regression in place. A follow-up is fine if this PR doesn't ship the conflicting defaults.
There was a problem hiding this comment.
Fixed in 6f2dc7d, following the option you offered. The entry now has NotShowIn=KDE;, and the system-wide kservicemenurc is gone from the deb/arch/fedora/nix payloads and from the checkout deploy, so a Plasma session keeps Plasma's working action. Ryoku sessions list both entries until a Ryoku-only config path exists; the README says how to switch Plasma's off. Test TestDolphinMenuStaysOutOfPlasmaSessions failed before and passes; payload-parity now asserts the file is not shipped.
🦊 mika's reviewIncremental review: new commits since the last checkpoint. Summary
Change diagramflowchart LR
Dolphin["Dolphin service menu"] --> Import["Ryogami import"]
Import --> Library["Wallpaper or video library"]
Import --> Apply["Apply wallpaper"]
Package["Desktop package and checkout deploy"] --> Dolphin
Package --> Config["Plasma action visibility default"]
Estimated review effort: 3/5 · risk: medium 📁 Walkthrough details
|
| Severity | Category | Fix effort | File | Issue |
|---|---|---|---|---|
| 🟠 major | data_integrity | medium | ryoku/shell/ryogami/daemon/library_import.go |
Data Integrity — On filesystems without hard links, the fallback exposes dest while copying into it. A library scan during a slow copy can process an incomplete image, including through automatic optimization. Publish the completed tem… |
⚡ Quick fixes by effort
Medium effort (a function-level change):
ryoku/shell/ryogami/daemon/library_import.go:210 — Data Integrity — On filesystems without hard links, the fallback exposesdestwhile copying into it. A library scan during a slow copy can process an incomplete image, including through automatic optimization. Publish the completed tem…
🤖 Prompt for AI agents (click, copy, paste into Claude/Codex)
Fix the following issues found by mika-agent on Ryoku-dev/ryoku#944 (branch dolphin-set-wallpaper):
- ryoku/shell/ryogami/daemon/library_import.go:210-216 — Data Integrity (major severity, medium effort): On filesystems without hard links, the fallback exposes `dest` while copying into it. A library scan during a slow copy can process an incomplete image, including through automatic optimization. Publish the completed tem…
For each: verify it is real in the current code, apply the smallest correct fix, and run the repo's tests. Skip anything already resolved and say why.
🛠 Deterministic checks run
- golangci-lint: not installed (skip)
- shellcheck: not installed (skip)
🚦 Merge recommendation: changes_required
🦊 Generated by Mika — the Ryoku org's self-hosted AI code reviewer. Machine findings: verify before merging.
neur0map
left a comment
There was a problem hiding this comment.
🔴 Changes requested — 0 critical and 2 major issue(s): see the inline comments and the walkthrough for fixes and an agent-ready prompt.
Dolphin's Set as Wallpaper comes from plasma-workspace and asks the Plasma shell over D-Bus, so on a Ryoku session it fails with "The name is not activatable". Ship a KIO service menu that runs ryogami wallpaper set instead, and a system kservicemenurc that hides Plasma's action. Note: Fixed: Dolphin's Set as Wallpaper now sets the Ryoku wallpaper instead of failing with a Plasma error
Setting a picture from Dolphin left it outside the wallpaper folder, so the picker never listed it. ryogami wallpaper import copies the picture into the library dir the picker scans (videos to the video dir), then sets it. A library file stays put, an identical copy is reused, and a different file with the same name is kept beside it. The Dolphin menu now calls it. Note: New: ryogami wallpaper import adds a picture to the wallpaper library and sets it; Dolphin's Set as Wallpaper uses it
Review follow-ups. The duplicate check read both files whole, so re-importing a large clip could exhaust the daemon's memory; it now compares in 64 KiB chunks. On filesystems without hard links the fallback renamed over a file that appeared mid-import; it now creates the destination exclusively. A name claimed by another import is weighed again (reused if identical, else the next name) instead of failing. The checkout deploy only hides Plasma's action while the user has not set that key, so a deliberate choice survives redeploys.
66635bb to
f0301d2
Compare
neur0map
left a comment
There was a problem hiding this comment.
🔍 Review findings — 2 blocking issue(s): see the inline comments and the walkthrough for details.
Blocking findings were addressed (verified at f0301d253c).
A still in the video dir, a file under a hidden folder, or a symlink in the library was treated as already listed and never copied, though the scanner skips all three. The in-place check now mirrors collectMedia's filters, and a symlink holding a name is never reused. The Dolphin menu no longer offers JPEG XL, which the library does not show; a test keeps its MIME list in step with the library's image types.
neur0map
left a comment
There was a problem hiding this comment.
🔴 Changes requested — 0 critical and 1 major issue(s): see the inline comments and the walkthrough for fixes and an agent-ready prompt.
A source named like .photo.jpg was copied under its hidden name, which the scanner skips, so it still never reached the picker; the copy now drops the leading dots. A file reached through a symlinked folder in the library counted as listed, but WalkDir does not follow folder symlinks, so the in-place check now refuses any symlinked folder on the way to the file.
neur0map
left a comment
There was a problem hiding this comment.
🔴 Changes requested — 0 critical and 1 major issue(s): see the inline comments and the walkthrough for fixes and an agent-ready prompt.
| // FAT, exFAT and some FUSE mounts have no hard links. Exclusive create | ||
| // still refuses a taken name; the file is just visible while it fills. | ||
| out, err := os.OpenFile(dest, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o644) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| if err := copyInto(out, tmp.Name()); err != nil { |
There was a problem hiding this comment.
🟠 major · Data Integrity · fix: medium effort
On filesystems without hard links, the fallback exposes dest while copying into it. A library scan during a slow copy can process an incomplete image, including through automatic optimization. Publish the completed temporary file atomically without replacing an existing destination.
Reply here to discuss, say it's fixed, or explain why it's intended — no mention needed.
There was a problem hiding this comment.
Fixed in 6f2dc7d. The fallback no longer creates dest early: it holds the name with a hidden .import-claim-<name> file (O_EXCL, ignored by the library walk), checks dest is still free, then renames the finished copy onto it. Nothing is ever visible empty or partial. A claim left by a dead import makes the next name get used rather than spinning. Test TestImportWithoutHardLinksNeverExposesAnEmptyDestination failed before (dest existed empty at rename) and passes now; ...SkipsAStaleClaim covers the dead-claim case.
The daemon resolved a relative import path against its own working directory, so ryogami wallpaper import photo.jpg found the wrong file or none; the client now resolves it before sending. A real read error in the duplicate check is returned instead of read as a mismatch. Without hard links the copy now finishes under its hidden temp name and is renamed over an exclusive placeholder, so a scan never sees it half written and a taken name is still refused.
|
I've reviewed 5 pushes on this PR automatically, so I'll stop doing full passes here and only check whether open threads get fixed. Add the |
Sipper1236
left a comment
There was a problem hiding this comment.
The importer is a good addition, but the no-hardlink path exposes an empty destination between the exclusive claim and rename, so the watcher can pick it up incomplete. Also, the system-wide KIO setting hides Plasma’s working action outside Ryoku; please scope that override to Ryoku sessions.
Note: Fixed: Dolphin's Set as Wallpaper no longer hides Plasma's action in Plasma sessions
|
Round update at 6f2dc7d: the no-hard-link fallback now holds the name with a hidden claim file and renames the finished copy in, so nothing is ever visible empty; the Dolphin entry is |
| claimPath := filepath.Join(filepath.Dir(dest), ".import-claim-"+filepath.Base(dest)) | ||
| claim, err := os.OpenFile(claimPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o644) |
There was a problem hiding this comment.
Long filenames fail to import. On an exFAT library drive, a valid 250-character ASCII filename reaches this fallback, but adding
.import-claim- makes the claim name 264 characters long. Creating it fails with “file name too long,” so the picture is neither imported nor applied. Use a bounded name derived from the destination, such as a hash, for the claim file.
Prompt To Fix With AI
This is a comment left during a code review.
Path: ryoku/shell/ryogami/daemon/library_import.go
Line: 229-230
Comment:
**Long filenames fail to import.** On an exFAT library drive, a valid 250-character ASCII filename reaches this fallback, but adding `.import-claim-` makes the claim name 264 characters long. Creating it fails with “file name too long,” so the picture is neither imported nor applied. Use a bounded name derived from the destination, such as a hash, for the claim file.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
Thanks for the work here, merged and renamed the entry to Set as Ryoku Wallpaper so it doesn't clash with KDE's, next update |
What changed
Right-clicking a picture in Dolphin and choosing Set as Wallpaper fails on a Ryoku session with:
That action is Plasma's
wallpaperfileitemaction(fromplasma-workspace). It asksorg.kde.plasmashellover D-Bus, and on Ryoku there is no Plasma shell to answer.This PR:
ryogami wallpaper import <path>(ryoku/shell/ryogami/daemon/library_import.go). It copies a picture into the library dir the picker scans, or a clip into the video dir, then sets it likeset. Without this, a picture set from Dolphin never showed up in the wallpaper picker. A file already in the library stays where it is, an identical copy is reused, an existing file is never overwritten (name-1.extinstead), and the copy goes through a hidden temp name so the library watcher never sees a half-written file. Withperformance.autoOptimizeImageson, the existing optimizer then re-encodes the import like any other new library picture.ryoku/apps/dolphin/ryoku-set-wallpaper.desktop, a KIO service menu for image types that runsryogami wallpaper import %fryoku/apps/dolphin/kservicemenurc([Show] wallpaperfileitemaction=false), which hides Plasma's broken action so the menu shows one wallpaper entryryoku-desktopinstalls both system-wide, to/usr/share/kio/servicemenus/and/etc/xdg/kservicemenurc. The second is an XDG system default, so a user's own~/.config/kservicemenurcstill overrides itryoku/shell/deploy.sh) installs the menu per user (executable, as KIO requires for user service menus) and sets the hide key withkwriteconfig6without overwriting the user's filetests/payload-parity.shchecks that all four editions (arch, void, fedora, fedora-spec) ship both files byte for byteryoku/apps/dolphin/README.md,docs/ryogami.md, the command catalog entry, and aryoku/CHANGELOG.mdentryArea
ryoku
How it was tested
On a running Ryoku 1.1.0 box (Hyprland, Dolphin with plasma-workspace 6.8.3 installed):
dolphin --daemon). The context menu shows a single Set as Wallpaper, and clicking it sets the wallpaper:~/.local/state/ryoku-wallpaperpoints at the clicked picture.kservicemenurconly at startup.O_EXCLfallback when there are no hard links, retry on a name claimed mid-import, an in-place check that mirrors the scanner, no JPEG XL in the menu, and a checkout deploy that respects the user's ownkservicemenurc. Each new test failed before its fix. Mutants that dropO_EXCL, stop the compare after one chunk, or skip the hidden-path rule each fail a test.library_import_test.go(13 cases) failed before the implementation and passes after. Disabling the in-library check, or the identical-copy reuse, each fails a test. A mode check caught the copy coming out0600instead of0644, which is now fixed.ryogami wallpaper import ~/Downloads/<photo>.jpg. The photo was copied into~/Pictures/Wallpapersand set, and it shows up in the wallpaper picker. A second import left one file.import /etc/hostnameis refused with "not an image or video the library shows".go vetis clean andgo test ./...passes for ryogami.tests/payload-parity.shpasses. With thekservicemenurcinstall removed frompayload.sh, it fails withryoku-desktop arch package does not hide Plasma's wallpaper action.bash -npasses on the touched scripts. Commit hooks ran (core.hooksPath .githooks), no--no-verify.Checklist
[area] scope: summarycommit subject.CHANGELOG.mdupdated in the area I touched.--no-verify.luac -p), shell scripts passbash -n, and QML passesqmllintwhere applicable.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge, with a non-blocking failure for long filenames on drives without hard links.Fix with agent prompt
Summary
Adds a Dolphin action that imports a picture into the wallpaper library before applying it. The follow-up keeps unfinished copies hidden on drives without hard links and avoids changing Plasma’s menu settings.
Reviews (11) · Last reviewed commit: "[ryoku] ryogami: hide the import claim, ..." · Reviewed by Greptile