Init Sequence: removed a bunch of no longer necessary Settings.isLoaded

This commit is contained in:
ItsLemmy
2025-09-29 09:11:37 -04:00
parent b8b54825d5
commit 9ed9231070
12 changed files with 34 additions and 44 deletions
+14 -23
View File
@@ -13,7 +13,7 @@ Variants {
required property ShellScreen modelData
active: Settings.isLoaded && modelData && Settings.data.wallpaper.enabled
active: modelData && Settings.data.wallpaper.enabled
sourceComponent: PanelWindow {
id: root
@@ -41,29 +41,10 @@ Variants {
property string futureWallpaper: ""
// Fillmode default is "crop"
property real fillMode: 1.0
property real fillMode: WallpaperService.getFillModeUniform()
property vector4d fillColor: Qt.vector4d(Settings.data.wallpaper.fillColor.r, Settings.data.wallpaper.fillColor.g, Settings.data.wallpaper.fillColor.b, 1.0)
// On startup, defer assigning wallpaper until the service cache is ready
function _startWallpaperOnceReady() {
if (!modelData) {
Qt.callLater(_startWallpaperOnceReady)
return
}
var cacheReady = WallpaperService && WallpaperService.currentWallpapers && Object.keys(WallpaperService.currentWallpapers).length > 0
if (!cacheReady) {
// Try again on the next tick until WallpaperService.init() populates cache
Qt.callLater(_startWallpaperOnceReady)
return
}
fillMode = WallpaperService.getFillModeUniform()
var path = WallpaperService.getWallpaper(modelData.name)
setWallpaperImmediate(path)
}
Component.onCompleted: _startWallpaperOnceReady()
Component.onCompleted: setWallpaperInitial()
Connections {
target: Settings.data.wallpaper
@@ -254,6 +235,16 @@ Variants {
})
}
}
function setWallpaperInitial() {
// On startup, defer assigning wallpaper until the service cache is ready, retries every tick
if (!WallpaperService || !WallpaperService.isInitialized) {
Qt.callLater(setWallpaperInitial)
return
}
setWallpaperImmediate(WallpaperService.getWallpaper(modelData.name))
}
function setWallpaperImmediate(source) {
transitionAnimation.stop()
@@ -324,4 +315,4 @@ Variants {
}
}
}
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ Variants {
delegate: Loader {
required property ShellScreen modelData
active: Settings.isLoaded && CompositorService.isNiri && modelData && Settings.data.wallpaper.enabled
active: CompositorService.isNiri && modelData && Settings.data.wallpaper.enabled
property string wallpaper: ""
+1 -1
View File
@@ -28,7 +28,7 @@ Variants {
}
}
active: Settings.isLoaded && BarService.isVisible && modelData && modelData.name ? (Settings.data.bar.monitors.includes(modelData.name) || (Settings.data.bar.monitors.length === 0)) : false
active: BarService.isVisible && modelData && modelData.name ? (Settings.data.bar.monitors.includes(modelData.name) || (Settings.data.bar.monitors.length === 0)) : false
sourceComponent: PanelWindow {
screen: modelData || null
+1 -1
View File
@@ -29,7 +29,7 @@ Item {
id: loader
anchors.fill: parent
active: Settings.isLoaded && widgetId !== ""
active: widgetId !== ""
sourceComponent: {
if (!active) {
return null
+3 -3
View File
@@ -55,7 +55,7 @@ Variants {
// Initial update when component is ready
Component.onCompleted: {
if (Settings.isLoaded && ToplevelManager) {
if (ToplevelManager) {
updateDockApps()
}
}
@@ -198,7 +198,7 @@ Variants {
// PEEK WINDOW - Always visible when auto-hide is enabled
Loader {
active: Settings.isLoaded && barIsReady && modelData && Settings.data.dock.monitors.includes(modelData.name) && autoHide
active: barIsReady && modelData && Settings.data.dock.monitors.includes(modelData.name) && autoHide
sourceComponent: PanelWindow {
id: peekWindow
@@ -244,7 +244,7 @@ Variants {
// DOCK WINDOW
Loader {
active: Settings.isLoaded && barIsReady && modelData && Settings.data.dock.monitors.includes(modelData.name) && dockLoaded && ToplevelManager && (dockApps.length > 0)
active: barIsReady && modelData && Settings.data.dock.monitors.includes(modelData.name) && dockLoaded && ToplevelManager && (dockApps.length > 0)
sourceComponent: PanelWindow {
id: dockWindow
+3 -3
View File
@@ -22,7 +22,7 @@ Variants {
property ListModel notificationModel: NotificationService.activeList
// If no notification display activated in settings, then show them all
active: Settings.isLoaded && modelData && (Settings.data.notifications.monitors.includes(modelData.name) || (Settings.data.notifications.monitors.length === 0))
active: modelData && (Settings.data.notifications.monitors.includes(modelData.name) || (Settings.data.notifications.monitors.length === 0))
Connections {
target: ScalingService
@@ -37,11 +37,11 @@ Variants {
screen: modelData
WlrLayershell.namespace: "noctalia-notifications"
WlrLayershell.layer: (Settings.isLoaded && Settings.data && Settings.data.notifications && Settings.data.notifications.alwaysOnTop) ? WlrLayer.Overlay : WlrLayer.Top
WlrLayershell.layer: (Settings.data.notifications && Settings.data.notifications.alwaysOnTop) ? WlrLayer.Overlay : WlrLayer.Top
color: Color.transparent
readonly property string location: (Settings.isLoaded && Settings.data && Settings.data.notifications && Settings.data.notifications.location) ? Settings.data.notifications.location : "top_right"
readonly property string location: (Settings.data.notifications && Settings.data.notifications.location) ? Settings.data.notifications.location : "top_right"
readonly property bool isTop: (location === "top") || (location.length >= 3 && location.substring(0, 3) === "top")
readonly property bool isBottom: (location === "bottom") || (location.length >= 6 && location.substring(0, 6) === "bottom")
readonly property bool isLeft: location.indexOf("_left") >= 0
+2 -2
View File
@@ -22,7 +22,7 @@ Variants {
property ListModel notificationModel: NotificationService.activeList
// If no notification display activated in settings, then show them all
property bool canShowOnThisScreen: Settings.isLoaded && modelData && (Settings.data.osd.monitors.includes(modelData.name) || (Settings.data.osd.monitors.length === 0))
property bool canShowOnThisScreen: modelData && (Settings.data.osd.monitors.includes(modelData.name) || (Settings.data.osd.monitors.length === 0))
// Loader is only active when actually showing something
active: false
@@ -104,7 +104,7 @@ Variants {
id: panel
screen: modelData
readonly property string location: (Settings.isLoaded && Settings.data && Settings.data.osd && Settings.data.osd.location) ? Settings.data.osd.location : "top_right"
readonly property string location: (Settings.data.osd && Settings.data.osd.location) ? Settings.data.osd.location : "top_right"
readonly property bool isTop: (location === "top") || (location.length >= 3 && location.substring(0, 3) === "top")
readonly property bool isBottom: (location === "bottom") || (location.length >= 6 && location.substring(0, 6) === "bottom")
readonly property bool isLeft: (location.indexOf("_left") >= 0) || (location === "left")
+1 -1
View File
@@ -16,6 +16,6 @@ Variants {
scaling: ScalingService.getScreenScale(modelData)
// Only activate on enabled screens
active: Settings.isLoaded && modelData && (Settings.data.notifications.monitors.includes(modelData.name) || Settings.data.notifications.monitors.length === 0)
active: modelData && (Settings.data.notifications.monitors.includes(modelData.name) || Settings.data.notifications.monitors.length === 0)
}
}
+1 -1
View File
@@ -128,7 +128,7 @@ Item {
screen: root.screen
readonly property string location: (Settings.isLoaded && Settings.data && Settings.data.notifications && Settings.data.notifications.location) ? Settings.data.notifications.location : "top_right"
readonly property string location: (Settings.data.notifications && Settings.data.notifications.location) ? Settings.data.notifications.location : "top_right"
readonly property bool isTop: (location === "top") || (location.length >= 3 && location.substring(0, 3) === "top")
readonly property bool isBottom: (location === "bottom") || (location.length >= 6 && location.substring(0, 6) === "bottom")
readonly property bool isLeft: location.indexOf("_left") >= 0
+1 -1
View File
@@ -10,7 +10,7 @@ Singleton {
id: root
// Public API
property bool active: Settings.isLoaded && Settings.data.appLauncher.enableClipboardHistory && cliphistAvailable
property bool active: Settings.data.appLauncher.enableClipboardHistory && cliphistAvailable
property bool loading: false
property var items: [] // [{id, preview, mime, isImage}]
+1 -6
View File
@@ -10,7 +10,7 @@ import qs.Services
Singleton {
id: root
property string dynamicConfigPath: Settings.isLoaded ? Settings.cacheDir + "matugen.dynamic.toml" : ""
property string dynamicConfigPath: Settings.cacheDir + "matugen.dynamic.toml"
// External state management
Connections {
@@ -47,11 +47,6 @@ Singleton {
// Generate colors using current wallpaper and settings
function generateFromWallpaper() {
if (!Settings.isLoaded) {
Logger.log("Matugen", "Settings not loaded yet, skipping wallpaper color generation")
return
}
Logger.log("Matugen", "Generating from wallpaper on screen:", Screen.name)
var wp = WallpaperService.getWallpaper(Screen.name).replace(/'/g, "'\\''")
if (wp === "") {
+5 -1
View File
@@ -26,6 +26,8 @@ Singleton {
// Cache for current wallpapers - can be updated directly since we use signals for notifications
property var currentWallpapers: ({})
property bool isInitialized: false
// Signals for reactive UI updates
signal wallpaperChanged(string screenName, string path)
// Emitted when a wallpaper changes
@@ -75,6 +77,8 @@ Singleton {
function init() {
Logger.log("Wallpaper", "Service started")
translateModels()
// Rebuild cache from persisted settings
var monitors = Settings.data.wallpaper.monitors || []
currentWallpapers = ({})
@@ -86,7 +90,7 @@ Singleton {
}
}
translateModels()
isInitialized = true
}
// -------------------------------------------------