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
191 lines (166 loc) · 4.5 KB
/
shell.qml
File metadata and controls
191 lines (166 loc) · 4.5 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
/*
* 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
import Quickshell.Services.SystemTray
// Commons & Services
import qs.Commons
// Modules
import qs.Modules.Background
import qs.Modules.Bar
import qs.Modules.Dock
import qs.Modules.LockScreen
import qs.Modules.MainScreen
import qs.Modules.Notification
import qs.Modules.OSD
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", "---------------------------");
WallpaperService.init();
AppThemeService.init();
ColorSchemeService.init();
LocationService.init();
NightLightService.apply();
DarkModeService.init();
HooksService.init();
BluetoothService.init();
IdleInhibitorService.init();
PowerProfileService.init();
HostService.init();
FontService.init();
GitHubService.init();
UpdateService.init();
UpdateService.showLatestChangelog();
checkSetupWizard();
}
Overview {}
Background {}
AllScreens {}
Dock {}
Notification {}
ToastOverlay {}
OSD {}
LockScreen {}
// IPCService is treated as a service but it must be in graphics scene.
IPCService {}
// Container for plugins Main.qml instances (must be in graphics scene)
Item {
id: pluginContainer
visible: false
Component.onCompleted: {
PluginService.pluginContainer = pluginContainer;
}
}
// Listen for when available plugins are fetched, then check for updates
Connections {
target: PluginService
property bool hasCheckedOnStartup: false
function onAvailablePluginsUpdated() {
if (!hasCheckedOnStartup) {
hasCheckedOnStartup = true;
PluginService.checkForUpdates();
}
}
}
}
}
// ---------------------------------------------
// Setup Wizard
// ---------------------------------------------
Timer {
id: setupWizardTimer
running: false
interval: 1000
onTriggered: {
showSetupWizard();
}
}
function checkSetupWizard() {
// Only open the setup wizard for new users
if (!Settings.shouldOpenSetupWizard) {
return;
}
// Wait for HostService to be fully ready
if (!HostService.isReady) {
Qt.callLater(checkSetupWizard);
return;
}
// No setup wizard on NixOS
if (HostService.isNixOS) {
return;
}
setupWizardTimer.start();
}
function showSetupWizard() {
// Open Setup Wizard as a panel in the same windowing system as Settings/ControlCenter
if (Quickshell.screens.length > 0) {
var targetScreen = Quickshell.screens[0];
var setupPanel = PanelService.getPanel("setupWizardPanel", targetScreen);
if (setupPanel) {
setupPanel.open();
} else {
// If not yet loaded, ensure it loads and try again shortly
setupWizardTimer.restart();
}
}
}
}