From b17ae550381232fd8c0cce5024e8ec0852918a33 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Mon, 11 Aug 2025 19:16:05 +0800 Subject: 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 --- shell.qml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'shell.qml') diff --git a/shell.qml b/shell.qml index 0c5e13e..9ad27fa 100644 --- a/shell.qml +++ b/shell.qml @@ -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 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 { -- cgit v1.2.3