// Copyright (C) 2026 Danilo M. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. pragma Singleton import Quickshell import QtQuick import "../.." import "TransitionPick.js" as TransitionPick // Which transition covers a wallpaper change. The page edits the draft, Apply // saves it, and each run asks next() once, so both screens play the same one. // See the spec, docs/superpowers/specs/2026-11-06-wallpaper-transitions-design.md. Singleton { id: root readonly property var all: [ { name: "burn", label: "Burn" }, { name: "ink", label: "Ink" }, { name: "shatter", label: "Shatter" }, { name: "ripple", label: "Ripple" }, { name: "melt", label: "Melt" }, { name: "blinds", label: "Blinds" }, { name: "crosswarp", label: "Cross-warp" }, ] readonly property var names: all.map(t => t.name) readonly property int duration: 3500 readonly property var saved: TransitionPick.clean(Prefs.wallTransition, names) property string draftPick: saved.pick property var draftPool: saved.pool onSavedChanged: reset() readonly property bool dirty: draftPick !== saved.pick || JSON.stringify(draftPool) !== JSON.stringify(saved.pool) readonly property bool valid: draftPick !== "random" || draftPool.length > 0 function toggle(name) { const on = draftPool.indexOf(name) >= 0; draftPool = names.filter(n => n === name ? !on : draftPool.indexOf(n) >= 0); } function reset() { draftPick = saved.pick; draftPool = saved.pool; } function apply() { if (valid) Prefs.setWallTransition({ pick: draftPick, pool: draftPool }); } property string last: "" function next() { last = TransitionPick.choose(saved.pick, saved.pool, last); return last; } }