Possible fix for unknown screen (bar not displaying)

This commit is contained in:
Ly-sec 2025-08-19 13:16:03 +02:00
parent 7b26ddaa32
commit 1993e28c18
4 changed files with 51 additions and 1 deletions

View file

@ -32,6 +32,36 @@ Singleton {
// Needed to only have one NPanel loaded at a time. <--- VERY BROKEN
//property var openPanel: null
// Function to validate monitor configurations
function validateMonitorConfigurations() {
var availableScreenNames = []
for (var i = 0; i < Quickshell.screens.length; i++) {
availableScreenNames.push(Quickshell.screens[i].name)
}
Logger.log("Settings", "Available monitors: [" + availableScreenNames.join(", ") + "]")
Logger.log("Settings", "Configured bar monitors: [" + adapter.bar.monitors.join(", ") + "]")
// Check bar monitors
if (adapter.bar.monitors.length > 0) {
var hasValidBarMonitor = false
for (var j = 0; j < adapter.bar.monitors.length; j++) {
if (availableScreenNames.includes(adapter.bar.monitors[j])) {
hasValidBarMonitor = true
break
}
}
if (!hasValidBarMonitor) {
Logger.log("Settings", "No configured bar monitors found on system, clearing bar monitor list to show on all screens")
adapter.bar.monitors = []
} else {
Logger.log("Settings", "Found valid bar monitors, keeping configuration")
}
} else {
Logger.log("Settings", "Bar monitor list is empty, will show on all available screens")
}
}
Item {
Component.onCompleted: {
@ -58,6 +88,10 @@ Singleton {
Logger.log("Settings", "Set current wallpaper", adapter.wallpaper.current)
WallpaperService.setCurrentWallpaper(adapter.wallpaper.current, true)
}
// Validate monitor configurations - if none of the configured monitors exist, clear the lists
validateMonitorConfigurations()
isInitialLoad = false
})
}