forked from noctalia-dev/noctalia-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.qml
More file actions
246 lines (210 loc) · 6.25 KB
/
shell.qml
File metadata and controls
246 lines (210 loc) · 6.25 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/*
* Noctalia – made by https://github.com/noctalia-dev
* Licensed under the MIT License.
* Forks and modifications are allowed under the MIT License,
* but proper credit must be given to the original author.
*/
// Qt & Quickshell Core
import QtQuick
import Quickshell
// Commons & Services
import qs.Commons
// Modules
import qs.Modules.Background
import qs.Modules.Bar
import qs.Modules.DesktopWidgets
import qs.Modules.Dock
import qs.Modules.LockScreen
import qs.Modules.MainScreen
import qs.Modules.Notification
import qs.Modules.OSD
import qs.Modules.Panels.Settings
import qs.Modules.Toast
import qs.Services.Control
import qs.Services.Hardware
import qs.Services.Location
import qs.Services.Networking
import qs.Services.Noctalia
import qs.Services.Power
import qs.Services.System
import qs.Services.Theming
import qs.Services.UI
ShellRoot {
id: shellRoot
property bool i18nLoaded: false
property bool settingsLoaded: false
property bool shellStateLoaded: false
Component.onCompleted: {
Logger.i("Shell", "---------------------------");
Logger.i("Shell", "Noctalia Hello!");
// Initialize plugin system early so Settings can validate plugin widgets
PluginRegistry.init();
}
Connections {
target: Quickshell
function onReloadCompleted() {
Quickshell.inhibitReloadPopup();
}
function onReloadFailed() {
if (!Settings?.isDebug) {
Quickshell.inhibitReloadPopup();
}
}
}
Connections {
target: I18n ? I18n : null
function onTranslationsLoaded() {
i18nLoaded = true;
}
}
Connections {
target: Settings ? Settings : null
function onSettingsLoaded() {
settingsLoaded = true;
}
}
Connections {
target: ShellState ? ShellState : null
function onIsLoadedChanged() {
if (ShellState.isLoaded) {
shellStateLoaded = true;
}
}
}
Loader {
active: i18nLoaded && settingsLoaded && shellStateLoaded
sourceComponent: Item {
Component.onCompleted: {
Logger.i("Shell", "---------------------------");
// Critical services needed for initial UI rendering
WallpaperService.init();
ImageCacheService.init();
AppThemeService.init();
ColorSchemeService.init();
DarkModeService.init();
// Defer non-critical services to unblock first frame
Qt.callLater(function () {
LocationService.init();
NightLightService.apply();
HooksService.init();
BluetoothService.init();
IdleInhibitorService.init();
PowerProfileService.init();
HostService.init();
GitHubService.init();
SupporterService.init();
});
delayedInitTimer.running = true;
}
Overview {}
Background {}
DesktopWidgets {}
AllScreens {}
Dock {}
Notification {}
ToastOverlay {}
OSD {}
LockScreen {}
// Settings window mode (single window across all monitors)
SettingsPanelWindow {}
// Shared screen detector for IPC and plugins
CurrentScreenDetector {
id: screenDetector
}
// IPCService is treated as a service but it must be in graphics scene.
IPCService {
id: ipcService
screenDetector: screenDetector
}
// CustomButtonIPCService handles IPC commands for custom buttons
CustomButtonIPCService {
id: customButtonIPCService
}
// Container for plugins Main.qml instances (must be in graphics scene)
Item {
id: pluginContainer
visible: false
Component.onCompleted: {
PluginService.pluginContainer = pluginContainer;
PluginService.screenDetector = screenDetector;
}
}
}
}
// ---------------------------------------------
// Delayed initialization and wizard/changelog
// ---------------------------------------------
Timer {
id: delayedInitTimer
running: false
interval: 1500
onTriggered: {
FontService.init();
UpdateService.init();
showWizardOrChangelog();
}
}
// Retry timer for when panel isn't ready yet
Timer {
id: wizardRetryTimer
running: false
interval: 500
property string pendingWizardType: "" // "setup", "telemetry", or ""
onTriggered: showWizardOrChangelog()
}
// Connect to telemetry wizard signal from UpdateService (for async state loading)
Connections {
target: UpdateService
function onTelemetryWizardNeeded() {
wizardRetryTimer.pendingWizardType = "telemetry";
showWizardOrChangelog();
}
}
property var telemetryWizardConnection: null
function showWizardOrChangelog() {
// Determine what to show: setup wizard > telemetry wizard > changelog
var wizardType = wizardRetryTimer.pendingWizardType;
if (wizardType === "") {
// First call - determine wizard type
if (Settings.shouldOpenSetupWizard) {
wizardType = "setup";
} else if (UpdateService.shouldShowTelemetryWizard()) {
wizardType = "telemetry";
} else {
// No wizard needed - init telemetry and show changelog
TelemetryService.init();
UpdateService.checkTelemetryWizardOrChangelog();
return;
}
}
var targetScreen = PanelService.findScreenForPanels();
if (!targetScreen) {
Logger.w("Shell", "No screen available to show wizard");
wizardRetryTimer.pendingWizardType = "";
return;
}
var setupPanel = PanelService.getPanel("setupWizardPanel", targetScreen);
if (!setupPanel) {
// Panel not ready, retry
wizardRetryTimer.pendingWizardType = wizardType;
wizardRetryTimer.restart();
return;
}
// Panel is ready, show it
wizardRetryTimer.pendingWizardType = "";
if (wizardType === "telemetry") {
setupPanel.telemetryOnlyMode = true;
// Connect to completion signal to show changelog afterward
if (telemetryWizardConnection) {
setupPanel.telemetryWizardCompleted.disconnect(telemetryWizardConnection);
}
telemetryWizardConnection = function () {
UpdateService.showLatestChangelog();
};
setupPanel.telemetryWizardCompleted.connect(telemetryWizardConnection);
} else {
setupPanel.telemetryOnlyMode = false;
}
setupPanel.open();
}
}