summaryrefslogtreecommitdiff
path: root/shell.qml
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-08-11 19:16:05 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-08-14 15:37:02 +0800
commitb17ae550381232fd8c0cce5024e8ec0852918a33 (patch)
treecaad80336bcc1ff6c9a8f576cd7dfe3aa26db242 /shell.qml
parent6a910bb63463facb7c5b72c2054740154934c7a4 (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.qml42
1 files changed, 42 insertions, 0 deletions
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<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 {