perf(mainscreen): collapse Mainscreen to bar-sized when idle

This commit is contained in:
Lemmy
2026-03-19 20:26:34 -04:00
parent b4d12870d1
commit b1f8a24da4
8 changed files with 45 additions and 13 deletions
-1
View File
@@ -33,7 +33,6 @@ PanelWindow {
// 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
// Position and size to match bar location (per-screen)
-1
View File
@@ -37,7 +37,6 @@ PanelWindow {
mask: Region {}
// Wayland layer shell configuration
WlrLayershell.layer: WlrLayer.Top
WlrLayershell.namespace: "noctalia-bar-exclusion-" + edge + "-" + (screen?.name || "unknown")
// When auto-hide, non-exclusive mode is enabled, OR bar is explicitly hidden via IPC, don't reserve space
// Note: We check BarService.isVisible directly, NOT effectivelyVisible, because we want
-1
View File
@@ -26,7 +26,6 @@ PanelWindow {
focusable: false
WlrLayershell.namespace: "noctalia-bar-trigger-" + (screen?.name || "unknown")
WlrLayershell.layer: WlrLayer.Top
WlrLayershell.exclusionMode: ExclusionMode.Ignore
// Anchor to bar's edge
+32 -5
View File
@@ -44,7 +44,6 @@ PanelWindow {
}
// Wayland
WlrLayershell.layer: WlrLayer.Top
WlrLayershell.namespace: "noctalia-background-" + (screen?.name || "unknown")
WlrLayershell.exclusionMode: ExclusionMode.Ignore // Don't reserve space - BarExclusionZone handles that
WlrLayershell.keyboardFocus: {
@@ -68,18 +67,37 @@ PanelWindow {
}
anchors {
top: true
bottom: true
left: true
right: true
top: isFramed || _needsFullscreen || _barPosition !== "bottom"
bottom: isFramed || _needsFullscreen || _barPosition !== "top"
left: isFramed || _needsFullscreen || _barPosition !== "right"
right: isFramed || _needsFullscreen || _barPosition !== "left"
}
// Implicit sizes control the non-anchored dimension when collapsed (3 anchors).
// Layout: [margin] [bar] [max(margin, shadow)] — screen-edge side uses margin, inner side uses whichever is larger.
// When fullscreen (4 anchors), compositor ignores these.
implicitWidth: Math.ceil(barPlaceholder.barMarginH + barPlaceholder.barHeight + _innerPaddingH)
implicitHeight: Math.ceil(barPlaceholder.barMarginV + barPlaceholder.barHeight + _innerPaddingV)
// Desktop dimming when panels are open
property real dimmerOpacity: Settings.data.general.dimmerOpacity ?? 0.8
property bool isPanelOpen: (PanelService.openedPanel !== null) && (PanelService.openedPanel.screen === screen)
property bool isPanelClosing: (PanelService.openedPanel !== null) && PanelService.openedPanel.isClosing
property bool isAnyPanelOpen: PanelService.openedPanel !== null
// Dynamic fullscreen management — collapse to bar-sized when idle to avoid fullscreen compositor damage
readonly property bool isFramed: Settings.data.bar.barType === "framed"
readonly property string _barPosition: Settings.getBarPositionForScreen(screen?.name)
readonly property bool _barIsVertical: _barPosition === "left" || _barPosition === "right"
property bool _needsFullscreen: isAnyPanelOpen || PanelService.closingPanel !== null || _dimmerAnimating
property bool _dimmerAnimating: false
// Shadow padding for collapsed window — shadow extends beyond bar into the screen
readonly property real _shadowPadding: (Settings.data.general.enableShadows && !PowerProfileService.noctaliaPerformanceMode) ? Style.shadowBlurMax + Math.max(Math.abs(Style.shadowHorizontalOffset), Math.abs(Style.shadowVerticalOffset)) : 0
// Inner padding: the side facing into the screen needs at least shadow clearance
readonly property real _innerPaddingH: Math.max(barPlaceholder.barMarginH, _shadowPadding)
readonly property real _innerPaddingV: Math.max(barPlaceholder.barMarginV, _shadowPadding)
color: {
if (dimmerOpacity > 0 && isPanelOpen && !isPanelClosing) {
return Qt.alpha(Color.mShadow, dimmerOpacity);
@@ -92,6 +110,7 @@ PanelWindow {
ColorAnimation {
duration: isPanelClosing ? Style.animationFaster : Style.animationNormal
easing.type: Easing.OutQuad
onRunningChanged: root._dimmerAnimating = running
}
}
@@ -461,6 +480,11 @@ PanelWindow {
// Expose bar dimensions directly on this Item for BarBackground
// Use screen dimensions directly
x: {
if (!root._needsFullscreen && !root.isFramed) {
// Collapsed: bar is at margin from screen edge, shadow extends inward.
// For right bar the window faces left (inner side first), so bar starts after shadow clearance.
return barPosition === "right" ? root._innerPaddingH : barMarginH;
}
if (barPosition === "right")
return (screen?.width ?? 0) - barHeight - barMarginH;
if (isFramed && !barIsVertical)
@@ -468,6 +492,9 @@ PanelWindow {
return barMarginH;
}
y: {
if (!root._needsFullscreen && !root.isFramed) {
return barPosition === "bottom" ? root._innerPaddingV : barMarginV;
}
if (barPosition === "bottom")
return (screen?.height ?? 0) - barHeight - barMarginV;
if (isFramed && barIsVertical)
+12 -2
View File
@@ -145,8 +145,10 @@ Item {
// Panel visibility and sizing
visible: isPanelVisible
width: parent ? parent.width : 0
height: parent ? parent.height : 0
// Always use screen dimensions for layout — MainScreen may be collapsed to bar-sized when idle,
// but panels must compute positions and sizes against the full screen.
width: screen?.width ?? (parent ? parent.width : 0)
height: screen?.height ?? (parent ? parent.height : 0)
// Panel control functions
function toggle(buttonItem, buttonName) {
@@ -290,6 +292,11 @@ Item {
PanelService.closedPanel(root);
closed();
// Flush pending double-buffered Wayland state (blur regions) that won't
// be committed otherwise — after an app launch the compositor may stop
// sending frame callbacks, leaving the render loop idle.
Window.window?.flushWaylandState();
Logger.d("SmartPanel", "Panel closed immediately", objectName);
}
@@ -316,6 +323,9 @@ Item {
PanelService.closedPanel(root);
closed();
// Flush pending double-buffered Wayland state (blur regions).
Window.window?.flushWaylandState();
Logger.d("SmartPanel", "Panel close finalized", objectName);
}