diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-08-19 18:57:48 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-08-19 20:50:46 +0800 |
| commit | a607f21ebaf6f7752626c1f568f90b36ec40c2c8 (patch) | |
| tree | 2b33d93aed3b28fa26a8dbda8a41c7bc7d6a9ac3 | |
| parent | 7419b49dbd9495f40f09d43bb26115a788d455d6 (diff) | |
feat(launcher): persist state between reloads
| -rw-r--r-- | launcher/components/SelectionState.qml | 21 | ||||
| -rw-r--r-- | shell.qml | 16 |
2 files changed, 30 insertions, 7 deletions
diff --git a/launcher/components/SelectionState.qml b/launcher/components/SelectionState.qml index 20d7fdf..1ab577a 100644 --- a/launcher/components/SelectionState.qml +++ b/launcher/components/SelectionState.qml @@ -3,12 +3,24 @@ import Quickshell import QtQuick Singleton { + id: root + + PersistentProperties { + id: persist + reloadableId: "launcherSelectionState" + + property string input: "" + property int cursorPosition: 0 + property int selectedPriority: 0 + property int previousSelectedPriority: 0 + } + property Item selected: null - property string input: "" - property int cursorPosition: 0 + property alias input: persist.input + property alias cursorPosition: persist.cursorPosition property var priorities: [] - property int selectedPriority: 0 - property int previousSelectedPriority: 0 + property alias selectedPriority: persist.selectedPriority + property alias previousSelectedPriority: persist.previousSelectedPriority property var widgets: [] onSelectedPriorityChanged: { @@ -22,7 +34,6 @@ Singleton { previousSelectedPriority = selectedPriority; } - // order them based on widgets(which came from order from config) onPrioritiesChanged: { for (let i = priorities.length - 1; i >= 0; i--) @@ -7,12 +7,24 @@ import QtQuick Scope { id: root + property var standaloneObj: ({}) + Bar {} + + PersistentProperties { + id: loaderProp + reloadableId: "launcherLoaderProp" + + property bool active: false + } LazyLoader { id: launcherLoader + + active: loaderProp.active + component: Launcher { - parentLoader: launcherLoader + parentLoader: loaderProp } } @@ -27,7 +39,7 @@ Scope { target: "launcher" function toggle() { - launcherLoader.active = !launcherLoader.active; + loaderProp.active = !loaderProp.active; } function standalone(component: string): void { |
