diff options
Diffstat (limited to 'desktop/modules/appearance/WallEngine.qml')
| -rw-r--r-- | desktop/modules/appearance/WallEngine.qml | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/desktop/modules/appearance/WallEngine.qml b/desktop/modules/appearance/WallEngine.qml index 9d90245..fe45f7b 100644 --- a/desktop/modules/appearance/WallEngine.qml +++ b/desktop/modules/appearance/WallEngine.qml @@ -31,6 +31,18 @@ Singleton { function list(which) { return which === "V" ? cfg.v : cfg.h; } function listed(path, which) { return list(which).indexOf(path) >= 0; } + // A gallery folder by its Wallpapers.groups key, "" for the hearted list. + function folder(which) { return which === "V" ? cfg.folderV : cfg.folderH; } + function setFolder(which, key) { Prefs.setWallEngine(which === "V" ? { folderV: key } : { folderH: key }); } + // What a tick draws from. A folder that is no longer in the gallery + // gives nothing, so that screen is left alone rather than falling back + // to the list behind the user's back. + function pool(which) { + const key = folder(which); + if (key === "") return list(which).filter(present); + const g = Wallpapers.groups.find(g => g.key === key); + return g ? g.files : []; + } // ponytail: present means in the gallery's last scan, so a file deleted // since stays drawable until a rescan, and wallp then skips it. function present(path) { return Wallpapers.files.indexOf(path) >= 0; } @@ -64,8 +76,8 @@ Singleton { // A screen whose list is empty, or whose pick is already up, is left out. function tick() { if (Wallpapers.applying) return; - const h = Shuffle.draw(cfg.h.filter(present), bagH, Wallpapers.currentH); - const v = Shuffle.draw(cfg.v.filter(present), bagV, Wallpapers.currentV); + const h = Shuffle.draw(pool("H"), bagH, Wallpapers.currentH); + const v = Shuffle.draw(pool("V"), bagV, Wallpapers.currentV); const ph = h.pick !== Wallpapers.currentH ? h.pick : ""; const pv = v.pick !== Wallpapers.currentV ? v.pick : ""; if (Wallpapers.run(ph, pv, "tick")) { |
