blob: 5805429f8ef177be45d16690f408b848b6371ad6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
import Quickshell
import Quickshell.Io
import "bar"
import "popups/launcher"
import QtQuick
import core
import qs.services
// TODO: remove all MouseArea and use modern alternative
Scope {
id: root
property var standaloneObj: ({})
Bar {}
PersistentProperties {
id: loaderProp
reloadableId: "launcherLoaderProp"
property bool active: false
}
// TODO: cache/don't destory when closed(active=false)
LazyLoader {
id: launcherLoader
active: loaderProp.active
component: Launcher {
parentLoader: loaderProp
}
}
IpcHandler {
target: "qs"
function reload(hard: bool): void {
Quickshell.reload(hard);
}
}
IpcHandler {
target: "launcher"
function toggle() {
loaderProp.active = !loaderProp.active;
}
function standalone(component: string): void {
if (root.standaloneObj.name === component) {
root.standaloneObj.obj.active = !root.standaloneObj.obj.active;
return;
}
root.standaloneObj.obj = Qt.createQmlObject(`
import Quickshell
import QtQuick
import "popups/launcher"
import "popups/launcher/components"
LazyLoader {
// TODO: just use the same selectionState
property QtObject selectionState: QtObject {
property Item selected: null
property string input: ""
property int cursorPosition: 0
property var priorities: []
property int selectedPriority: 0
property var widgets: []
}
readonly property list<Component> widgets: [
Component {
Loader {
sourceComponent: Qt.createComponent("popups/launcher/components/" + "${component}.qml")
onLoaded: {
item.standalone = true
item.state = selectionState;
item.close.connect(() => root.active = false);
}
}
}
]
id: root
active: true
component: Launcher {
widgetItems: widgets
state: selectionState
parentLoader: root
}
}
`, root);
root.standaloneObj.name = component;
}
}
Connections {
target: Quickshell
function onReloadCompleted() {
Quickshell.inhibitReloadPopup();
}
// function onReloadFailed() {
// Quickshell.inhibitReloadPopup();
// }
}
}
|