Shell: changed init sequence so that i18n + Settings are fully loaded before any UI component spawn.

This commit is contained in:
ItsLemmy
2025-09-28 23:39:34 -04:00
parent c1d2d82fa2
commit 49961882dd
4 changed files with 113 additions and 94 deletions
+2 -1
View File
@@ -53,9 +53,10 @@ Singleton {
try {
var data = JSON.parse(text())
root.translations = data
Logger.log("I18n", `Loaded translations for "${root.langCode}"`)
root.isLoaded = true
root.translationsLoaded()
Logger.log("I18n", `Loaded translations for "${root.langCode}"`)
} catch (e) {
Logger.error("I18n", `Failed to parse translation file: ${e}`)
setLanguage("en")
+1 -19
View File
@@ -90,15 +90,10 @@ Singleton {
}
onLoaded: function () {
if (!isLoaded) {
Logger.log("Settings", "----------------------------")
Logger.log("Settings", "Settings loaded successfully")
Logger.log("Settings", "Settings loaded")
upgradeSettingsData()
validateMonitorConfigurations()
kickOffServices()
isLoaded = true
// Emit the signal
@@ -515,17 +510,4 @@ Singleton {
const widgetAfter = JSON.stringify(widget)
return (widgetAfter !== widgetBefore)
}
// -----------------------------------------------------
// Kickoff essential services
function kickOffServices() {
LocationService.init()
NightLightService.apply()
ColorSchemeService.init()
MatugenService.init()
WallpaperService.init()
FontService.init()
HooksService.init()
BluetoothService.init()
}
}
+2 -2
View File
@@ -251,7 +251,7 @@ RowLayout {
anchors.verticalCenter: parent.verticalCenter
icon: "chevron-right"
font.pointSize: Style.fontSizeS * scaling
color: increaseArea.containsMouse ? Color.mOnTertiary: Color.mPrimary
color: increaseArea.containsMouse ? Color.mOnTertiary : Color.mPrimary
}
MouseArea {
@@ -354,4 +354,4 @@ RowLayout {
}
}
}
}
}
+108 -72
View File
@@ -29,7 +29,6 @@ import qs.Modules.Bar
import qs.Modules.Bar.Extras
import qs.Modules.Bar.Bluetooth
import qs.Modules.Bar.Calendar
import qs.Modules.Bar.WiFi
// Panels & UI Components
@@ -45,79 +44,12 @@ import qs.Modules.Wallpaper
ShellRoot {
id: shellRoot
Background {}
Overview {}
ScreenCorners {}
Bar {}
Dock {}
Notification {
id: notification
}
LockScreen {
id: lockScreen
}
ToastOverlay {}
OSD {}
// IPCService is treated as a service
// but it's actually an Item that needs to exists in the shell.
IPCService {}
// ------------------------------
// All the NPanels
Launcher {
id: launcherPanel
objectName: "launcherPanel"
}
ControlCenterPanel {
id: controlCenterPanel
objectName: "controlCenterPanel"
}
CalendarPanel {
id: calendarPanel
objectName: "calendarPanel"
}
SettingsPanel {
id: settingsPanel
objectName: "settingsPanel"
}
NotificationHistoryPanel {
id: notificationHistoryPanel
objectName: "notificationHistoryPanel"
}
SessionMenu {
id: sessionMenuPanel
objectName: "sessionMenuPanel"
}
WiFiPanel {
id: wifiPanel
objectName: "wifiPanel"
}
BluetoothPanel {
id: bluetoothPanel
objectName: "bluetoothPanel"
}
WallpaperPanel {
id: wallpaperPanel
objectName: "wallpaperPanel"
}
property bool i18nLoaded: false
property bool settingsLoaded: false
Component.onCompleted: {
// Save a ref. to our lockScreen so we can access it easily
PanelService.lockScreen = lockScreen
BarWidgetRegistry.init()
Logger.log("Shell", "---------------------------")
Logger.log("Shell", "Noctalia Hello!")
}
Connections {
@@ -126,4 +58,108 @@ ShellRoot {
Quickshell.inhibitReloadPopup()
}
}
Connections {
target: I18n
function onTranslationsLoaded() {
i18nLoaded = true
}
}
Connections {
target: Settings
function onSettingsLoaded() {
settingsLoaded = true
}
}
LazyLoader {
active: i18nLoaded && settingsLoaded
Item {
Component.onCompleted: {
// Save a ref. to our lockScreen so we can access it easily
PanelService.lockScreen = lockScreen
Logger.log("Shell", "---------------------------")
BarWidgetRegistry.init()
LocationService.init()
NightLightService.apply()
ColorSchemeService.init()
MatugenService.init()
WallpaperService.init()
FontService.init()
HooksService.init()
BluetoothService.init()
}
Background {}
Overview {}
ScreenCorners {}
Bar {}
Dock {}
Notification {
id: notification
}
LockScreen {
id: lockScreen
}
ToastOverlay {}
OSD {}
// IPCService is treated as a service
// but it's actually an Item that needs to exists in the shell.
IPCService {}
// ------------------------------
// All the NPanels
Launcher {
id: launcherPanel
objectName: "launcherPanel"
}
ControlCenterPanel {
id: controlCenterPanel
objectName: "controlCenterPanel"
}
CalendarPanel {
id: calendarPanel
objectName: "calendarPanel"
}
SettingsPanel {
id: settingsPanel
objectName: "settingsPanel"
}
NotificationHistoryPanel {
id: notificationHistoryPanel
objectName: "notificationHistoryPanel"
}
SessionMenu {
id: sessionMenuPanel
objectName: "sessionMenuPanel"
}
WiFiPanel {
id: wifiPanel
objectName: "wifiPanel"
}
BluetoothPanel {
id: bluetoothPanel
objectName: "bluetoothPanel"
}
WallpaperPanel {
id: wallpaperPanel
objectName: "wallpaperPanel"
}
}
}
}