diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-06 17:42:27 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-06 17:42:27 +0100 |
| commit | df12ed91675a64afd0b0248d2487e9a94d860830 (patch) | |
| tree | f9fba6ffcaec1eb00c6f4bba0768ce4a901ab397 /desktop/modules/appearance/Transitions.qml | |
| parent | f2252bf6987dbb0e06f46cf44e1ad2076fc8b475 (diff) | |
| download | quickshell-df12ed91675a64afd0b0248d2487e9a94d860830.tar.gz quickshell-df12ed91675a64afd0b0248d2487e9a94d860830.zip | |
wallpaper: a singleton for the chosen transition
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/appearance/Transitions.qml')
| -rw-r--r-- | desktop/modules/appearance/Transitions.qml | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/desktop/modules/appearance/Transitions.qml b/desktop/modules/appearance/Transitions.qml new file mode 100644 index 0000000..e28718c --- /dev/null +++ b/desktop/modules/appearance/Transitions.qml @@ -0,0 +1,63 @@ +// Copyright (C) 2026 Danilo M. <danix@danix.xyz> +// +// 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; + } +} |
