Possible fix for unknown screen (bar not displaying)
This commit is contained in:
parent
7b26ddaa32
commit
1993e28c18
4 changed files with 51 additions and 1 deletions
|
|
@ -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
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ Rectangle {
|
|||
id: tooltip
|
||||
target: root
|
||||
positionAbove: Settings.data.bar.barPosition === "bottom"
|
||||
positionLeft: Settings.data.bar.barPosition === "right"
|
||||
positionRight: Settings.data.bar.barPosition === "left"
|
||||
text: root.tooltipText
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -169,6 +169,8 @@ Item {
|
|||
NTooltip {
|
||||
id: tooltip
|
||||
positionAbove: Settings.data.bar.barPosition === "bottom"
|
||||
positionLeft: Settings.data.bar.barPosition === "right"
|
||||
positionRight: Settings.data.bar.barPosition === "left"
|
||||
target: pill
|
||||
delay: Style.tooltipDelayLong
|
||||
text: root.tooltipText
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ Window {
|
|||
property Item target: null
|
||||
property int delay: Style.tooltipDelay
|
||||
property bool positionAbove: false
|
||||
property bool positionLeft: false
|
||||
property bool positionRight: false
|
||||
|
||||
flags: Qt.ToolTip | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint
|
||||
color: Color.transparent
|
||||
|
|
@ -44,7 +46,17 @@ Window {
|
|||
return
|
||||
}
|
||||
|
||||
if (positionAbove) {
|
||||
if (positionLeft) {
|
||||
// Position tooltip to the left of the target
|
||||
var pos = target.mapToGlobal(0, 0)
|
||||
x = pos.x - width - 12 // 12 px margin to the left
|
||||
y = pos.y - height / 2 + target.height / 2
|
||||
} else if (positionRight) {
|
||||
// Position tooltip to the right of the target
|
||||
var pos = target.mapToGlobal(target.width, 0)
|
||||
x = pos.x + 12 // 12 px margin to the right
|
||||
y = pos.y - height / 2 + target.height / 2
|
||||
} else if (positionAbove) {
|
||||
// Position tooltip above the target
|
||||
var pos = target.mapToGlobal(0, 0)
|
||||
x = pos.x - width / 2 + target.width / 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue