From 49961882dd10381ce3bc273860a51197effa5f11 Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Sun, 28 Sep 2025 23:39:34 -0400 Subject: [PATCH] Shell: changed init sequence so that i18n + Settings are fully loaded before any UI component spawn. --- Commons/I18n.qml | 3 +- Commons/Settings.qml | 20 +---- Widgets/NSpinBox.qml | 4 +- shell.qml | 180 ++++++++++++++++++++++++++----------------- 4 files changed, 113 insertions(+), 94 deletions(-) diff --git a/Commons/I18n.qml b/Commons/I18n.qml index 564f67f2..3a013c57 100644 --- a/Commons/I18n.qml +++ b/Commons/I18n.qml @@ -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") diff --git a/Commons/Settings.qml b/Commons/Settings.qml index bed06a98..986d4248 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -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() - } } diff --git a/Widgets/NSpinBox.qml b/Widgets/NSpinBox.qml index 278eb7b6..72be80d2 100644 --- a/Widgets/NSpinBox.qml +++ b/Widgets/NSpinBox.qml @@ -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 { } } } -} \ No newline at end of file +} diff --git a/shell.qml b/shell.qml index 65cbf272..4a7afb58 100644 --- a/shell.qml +++ b/shell.qml @@ -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" + } + } + } }