BarContent: fix screen assignment

This commit is contained in:
ItsLemmy
2025-11-09 13:50:20 -05:00
parent c3476c9f9e
commit 23a548e034
3 changed files with 37 additions and 50 deletions
+33 -49
View File
@@ -12,61 +12,45 @@ import qs.Modules.Bar
* This window contains only the bar widgets (content), while the background
* is rendered in MainScreen's unified Shape system. This separation prevents
* fullscreen redraws when bar widgets redraw.
*
* This component should be instantiated once per screen by AllScreens.qml
*/
Variants {
model: Quickshell.screens
PanelWindow {
id: barWindow
delegate: Loader {
id: barWindowLoader
// Note: screen property is inherited from PanelWindow and should be set by parent
color: Color.transparent // Transparent - background is in MainScreen below
required property ShellScreen modelData
Component.onCompleted: {
Logger.d("BarContentWindow", "Bar content window created for screen:", barWindow.screen?.name)
}
// Only create window if bar should be visible on this screen
active: {
if (!modelData || !modelData.name)
return false
var monitors = Settings.data.bar.monitors || []
return BarService.isVisible && (monitors.length === 0 || monitors.includes(modelData.name))
}
// Wayland layer configuration
WlrLayershell.namespace: "noctalia-bar-content-" + (barWindow.screen?.name || "unknown")
WlrLayershell.layer: WlrLayer.Top
WlrLayershell.exclusionMode: ExclusionMode.Ignore // Don't reserve space - BarExclusionZone in MainScreen handles that
sourceComponent: PanelWindow {
id: barWindow
screen: modelData
// Position and size to match bar location
readonly property string barPosition: Settings.data.bar.position || "top"
readonly property bool barIsVertical: barPosition === "left" || barPosition === "right"
readonly property bool barFloating: Settings.data.bar.floating || false
readonly property real barMarginH: barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
readonly property real barMarginV: barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0
color: Color.transparent // Transparent - background is in MainScreen below
// Anchor to the bar's edge
anchors {
top: barPosition === "top" || barIsVertical
bottom: barPosition === "bottom" || barIsVertical
left: barPosition === "left" || !barIsVertical
right: barPosition === "right" || !barIsVertical
}
// Set to FULL screen dimensions - margins will reduce the actual window size
implicitWidth: (barIsVertical ? (Style.barHeight + 1) : barWindow.screen.width) + barMarginH
implicitHeight: (barIsVertical ? barWindow.screen.height : Style.barHeight) + barMarginV
Component.onCompleted: {
Logger.d("BarContentWindow", "Bar content window created for screen:", screen?.name)
}
// Wayland layer configuration
WlrLayershell.namespace: "noctalia-bar-content-" + (screen?.name || "unknown")
WlrLayershell.layer: WlrLayer.Top
WlrLayershell.exclusionMode: ExclusionMode.Ignore // Don't reserve space - BarExclusionZone in MainScreen handles that
// Position and size to match bar location
readonly property string barPosition: Settings.data.bar.position || "top"
readonly property bool barIsVertical: barPosition === "left" || barPosition === "right"
readonly property bool barFloating: Settings.data.bar.floating || false
readonly property real barMarginH: barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
readonly property real barMarginV: barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0
// Anchor to the bar's edge
anchors {
top: barPosition === "top" || barIsVertical
bottom: barPosition === "bottom" || barIsVertical
left: barPosition === "left" || !barIsVertical
right: barPosition === "right" || !barIsVertical
}
// Set to FULL screen dimensions - margins will reduce the actual window size
implicitWidth: (barIsVertical ? (Style.barHeight + 1) : screen.width) + barMarginH
implicitHeight: (barIsVertical ? screen.height : Style.barHeight) + barMarginV
// Bar content - just the widgets, no background
Bar {
anchors.fill: parent
screen: modelData
}
}
// Bar content - just the widgets, no background
Bar {
anchors.fill: parent
screen: barWindow.screen
}
}