diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-08-11 19:16:05 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-08-14 15:37:02 +0800 |
| commit | b17ae550381232fd8c0cce5024e8ec0852918a33 (patch) | |
| tree | caad80336bcc1ff6c9a8f576cd7dfe3aa26db242 /shell.qml | |
| parent | 6a910bb63463facb7c5b72c2054740154934c7a4 (diff) | |
feat(shell): implement standalone function for dynamic component loading
feat(Searchable): add Include algorithm and update filtering logic
fix(Launcher): refactor state handling and improve selection logic
fix(Clip): update clipHist property initialization and selection state sync
refactor(IComponent): enhance state management and streamline properties
refactor(Clip): change algorithm to Include for improved search functionality
Diffstat (limited to 'shell.qml')
| -rw-r--r-- | shell.qml | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -7,6 +7,7 @@ import QtQuick import QtQuick.Layouts Scope { + id: root Bar {} LazyLoader { id: launcherLoader @@ -28,6 +29,47 @@ Scope { function toggle() { launcherLoader.active = !launcherLoader.active; } + + function standalone(component: string): void { + // NOTE: 'component' must be a QML type name (e.g., 'Calc'), not a 'Component { ... }' block. + // Passing a full Component block will cause a QML error. + Qt.createQmlObject(` + import Quickshell + import QtQuick + import "launcher" + import "launcher/components" + + LazyLoader { + property QtObject selectionState: QtObject { + property Item selected: null + property string input: "" + property int cursorPosition: 0 + property var priorities: [] + property int selectedPriority: 0 + property int previousSelectedPriority: 0 + property var widgets: [] + } + readonly property list<Component> widgets: [ + Component { + Loader { + sourceComponent: Qt.createComponent("launcher/components/" + "${component}.qml") + onLoaded: { + item.standalone = true + item.state = selectionState; + } + } + } + ] + id: root + active: true + component: Launcher { + widgetItems: widgets + state: selectionState + parentLoader: root + } + } + `, root); + } } Connections { |
