Repository navigation
feat(wallpaper): add folder-based wallpaper selection and shuffle - #2990
Conversation
f8a6db0 to
83c600a
Compare
bbedward
left a comment
There was a problem hiding this comment.
I merged the qml-common change, so you can bump the submodule ref in this PR
a767f9a to
f298161
Compare
| folderMode: true | ||
| showHiddenFiles: true | ||
| onFileSelected: path => { | ||
| var folderPath = path.startsWith("file://") ? path.substring(7) : path; |
There was a problem hiding this comment.
onFileSelected callback already strips the file:// from path, so this can be removed. We also prefer the Paths.strip helper in general where it is needed
| onFileSelected: path => { | ||
| var folderPath = path.startsWith("file://") ? path.substring(7) : path; | ||
| var targetMonitor = SessionData.perMonitorWallpaper ? selectedMonitorName : ""; | ||
| WallpaperCyclingService.cycleToNextWallpaper(targetMonitor, folderPath + "/dummy.jpg"); |
There was a problem hiding this comment.
I think we can add a proper function in WallpaperCyclingService, would make it clearer than using dummy.jpg
function cycleFromFolder(screenName, folderPath) {
listWallpapers(folderPath, files => applyFirstWallpaper(screenName, files));
}
f298161 to
8837a22
Compare
|
@bbedward changes are done, please check again. |
8837a22 to
429b178
Compare
|
/claude review |
| process.currentWallpaper = ""; | ||
| process.goToPrevious = false; | ||
| process.running = true; | ||
| return; | ||
| } | ||
|
|
||
| var globalProcess = cyclingProcess; | ||
| globalProcess.command = findCommand(folderPath); | ||
| globalProcess.targetScreenName = screenName || ""; | ||
| globalProcess.currentWallpaper = ""; |
There was a problem hiding this comment.
Passing currentWallpaper = "" makes applyCycledWallpaper skip the first image in the folder. With currentPath === "", findIndex returns -1, so currentIndex is coerced to 0 and the non-random branch computes targetIndex = (0 + 1) % length → the second file alphabetically. So selecting a folder with 2+ wallpapers never applies the first one (and with random cycling on, the do/while excludes index 0, so the first image can't be picked on the initial selection either). Only the single-file case works, because 1 % 1 === 0.
Either apply wallpaperList[0] directly for the folder-select path (the applyFirstWallpaper shape suggested earlier), or pass a sentinel that applyCycledWallpaper understands as "start at the first entry" instead of reusing the "next from current" logic.
| if (!folderPath) | ||
| return; | ||
|
|
||
| SessionData.wallpaperCyclingFolderPath = folderPath; |
There was a problem hiding this comment.
wallpaperCyclingFolderPath is written here (and declared in SessionData.qml / SessionSpec.js) but never read anywhere — no other QML, and buildServerConfig() doesn't send it to the server either. So the "persist folder selection across restarts" goal isn't actually achieved; after a restart cycling still derives the directory from SessionData.wallpaperPath in cycle(). Either consume it (e.g. prefer it over the current wallpaper's dirname in cycle()) or drop the setting so it isn't persisted dead state.
|
|
||
| FileBrowserModal { | ||
| parentModal: root.parentModal | ||
| browserTitle: I18n.tr("Select Wallpaper Folder", "wallpaper folder file browser title") |
There was a problem hiding this comment.
Select Wallpaper Folder is a new term, but Choose wallpaper folder already exists in quickshell/translations/en.json and is already translated in several locales. CONTRIBUTING asks to reuse existing terms where possible.
| browserTitle: I18n.tr("Select Wallpaper Folder", "wallpaper folder file browser title") | |
| browserTitle: I18n.tr("Choose wallpaper folder", "wallpaper folder file browser title") |
Claude reviewFeature works end-to-end, but folder selection skips the first wallpaper and the new persisted setting is never read.
Checked: cycling logic against the |
|
/claude review |
| let wallpaperDir; | ||
| if (SessionData.wallpaperCyclingFolderPath) { | ||
| wallpaperDir = SessionData.wallpaperCyclingFolderPath; | ||
| } else { | ||
| wallpaperDir = currentWallpaper.substring(0, currentWallpaper.lastIndexOf('/')); | ||
| } |
There was a problem hiding this comment.
Once wallpaperCyclingFolderPath is set it is never cleared, so it permanently overrides the directory of the actual current wallpaper. Pick folder /A, then pick a single file /B/pic.png via "Select Wallpaper", then hit next: cycle() still lists /A, findIndex("/B/pic.png") is -1 → currentIndex = 0 → applies /A's second file. Neither setWallpaper() nor clearWallpaper() resets the setting and there is no UI to clear it, so the shell can never go back to "cycle within the current wallpaper's folder".
Reset SessionData.wallpaperCyclingFolderPath = "" whenever a wallpaper file is chosen directly (main browser / setWallpaper / clearWallpaper), or only use the stored folder when the current wallpaper is actually inside it.
| SessionData.wallpaperCyclingFolderPath = folderPath; | ||
| SessionData.saveSettings(); |
There was a problem hiding this comment.
In per-monitor mode WallpaperTab calls cycleFromFolder(selectedMonitorName, path), but the folder is stored in a single global setting. Choosing a folder for DP-1 therefore also redirects HDMI-A-1: cycleNextForMonitor("HDMI-A-1") → cycle() reads the same wallpaperCyclingFolderPath and lists DP-1's folder. Per-monitor cycling state lives in SessionData.monitorCyclingSettings (see getMonitorCyclingSettings) — store the folder there when screenName is set, and only write the global one for screenName === "".
| "intervalSec": s.interval || 300, | ||
| "time": s.time || "06:00" | ||
| "time": s.time || "06:00", | ||
| "folderPath": SessionData.wallpaperCyclingFolderPath || "" |
There was a problem hiding this comment.
This field is dropped on the wire: the server decodes into wallpaper.ScheduleConfig (core/internal/server/wallpaper/types.go:5), which only has enabled/mode/intervalSec/time, so folderPath is silently discarded. It's also the global value copied into every per-monitor entry, and it isn't sent in global at all. The server only schedules ticks — it never resolves wallpaper files — so nothing needs it; drop the line.
Claude reviewEarlier findings are fixed; the remaining issues are all about the new global
Checked: the first-image fix ( |
|
/claude review |
Claude reviewNo issues found. All three findings from the previous round are addressed. Checked:
Model: claude-opus-5. |
…xlabs-dev#2990) * feat(wallpaper): add folder-based wallpaper selection and shuffle * fix(wallpaper): bump 'dank-qml-common' and handle single-wallpaper folders * fix(wallpaper): address review feedback for folder selection * fix(wallpaper): persist folder selection across restarts * fix(wallpaper): pick first wallpaper on folder select and persist folder path * fix: resolve wallpaper cycling folder persistence issues
Description
Adds a dedicated folder picker in the Settings wallpaper tab, allowing users to explicitly select an entire directory for automatic cycling without needing to manually select a dummy file.
Additionally, introduces a new Shuffle toggle to the Automatic Cycling configuration. When enabled, the background service seamlessly pipes the dynamically queried wallpaper list to
shufinstead ofsort, ensuring a truly random wallpaper is picked on every cycle while immediately adapting to any external file changes in the directory (e.g. from Nix or sync tools).Note: Depends on the
dank-qml-commonFileBrowser folderMode fix submitted in this PR to resolve folder highlighting edge cases.Type of change
Related issues
Closes #2833
Screenshots / video
recording.mp4
Checklist
I18n.tr()with translator context, reusing existing terms where possiblemake fmt, added/updated tests,make testpasses, andgo mod tidyis cleanmake lint-qmlwith no new warnings