From 73da4879f65c4c27851e1df614b57fa59d907205 Mon Sep 17 00:00:00 2001 From: bbedward Date: Mon, 27 Jul 2026 13:10:36 -0400 Subject: [PATCH] frame: consolidate and simplify inset logic --- quickshell/Common/SettingsData.qml | 16 +++++++++++---- quickshell/Modules/DankBar/DankBarContent.qml | 9 ++++----- quickshell/Modules/Dock/DockGeometry.qml | 3 +-- quickshell/Modules/Frame/FrameExclusions.qml | 2 +- quickshell/Modules/Frame/FrameWindow.qml | 20 +++++++++++++++---- .../Popup/NotificationPopupManager.qml | 3 +-- quickshell/Modules/Settings/FrameTab.qml | 2 +- quickshell/Widgets/DankPopoutConnected.qml | 6 ++---- 8 files changed, 38 insertions(+), 23 deletions(-) diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index c56183e28..65b777664 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -2556,11 +2556,19 @@ Singleton { return edges; } - function frameEdgeInsetForSide(screen, side) { - if (!frameEnabled || !screen) + readonly property real frameBarContentGap: frameBarInsetPadding < 0 ? frameThickness : frameBarInsetPadding + readonly property real frameBarContentGapExtra: Math.max(0, frameBarContentGap - frameThickness) + + function frameEdgeReservation(screen, edge) { + if (!screen) return 0; - const edges = getActiveBarEdgesForScreen(screen); - return edges.includes(side) ? frameBarSize : frameThickness; + return getActiveBarEdgesForScreen(screen).includes(edge) ? frameBarSize : frameThickness; + } + + function frameEdgeInsetForSide(screen, side) { + if (!frameEnabled) + return 0; + return frameEdgeReservation(screen, side); } function setMatugenScheme(scheme) { diff --git a/quickshell/Modules/DankBar/DankBarContent.qml b/quickshell/Modules/DankBar/DankBarContent.qml index 7eab90e20..fbbfe7b50 100644 --- a/quickshell/Modules/DankBar/DankBarContent.qml +++ b/quickshell/Modules/DankBar/DankBarContent.qml @@ -38,11 +38,10 @@ Item { readonly property real _barInsetPaddingRaw: SettingsData.barInsetPaddingSyncAll ? SettingsData.barInsetPaddingShared : (barConfig?.barInsetPadding ?? -1) readonly property real _barInsetPaddingAuto: _barIsVertical ? Theme.spacingXS : _edgeBaseMargin readonly property real _barInsetPadding: _barInsetPaddingRaw < 0 ? _barInsetPaddingAuto : _barInsetPaddingRaw - // Connected-frame Bar Inset Padding: absolute free-end gap the hosted bar spans full-width into - // (auto < 0 = frameThickness so widgets align with the interior cutout, 0 = edge-to-edge). The extra - // beyond frameThickness is what an adjacent bar end adds on top of its corner alignment. - readonly property real _frameInsetResolved: SettingsData.frameBarInsetPadding < 0 ? SettingsData.frameThickness : SettingsData.frameBarInsetPadding - readonly property real _frameInsetExtra: Math.max(0, _frameInsetResolved - SettingsData.frameThickness) + // Hosted bars span their edge fully; frameBarContentGap is the free-end gap measured from the + // screen edge (auto = frameThickness, aligning widgets with the interior cutout). + readonly property real _frameInsetResolved: SettingsData.frameBarContentGap + readonly property real _frameInsetExtra: SettingsData.frameBarContentGapExtra // Horizontal bars span the full width and own the corners; the perpendicular vertical bar // tucks in below/above. Where they meet, inset the corner widget so it centres in the diff --git a/quickshell/Modules/Dock/DockGeometry.qml b/quickshell/Modules/Dock/DockGeometry.qml index b4a8c9342..e7a362bfb 100644 --- a/quickshell/Modules/Dock/DockGeometry.qml +++ b/quickshell/Modules/Dock/DockGeometry.qml @@ -21,11 +21,10 @@ QtObject { readonly property bool frameExclusionActive: CompositorService.frameWindowVisibleForScreen(screen) readonly property bool usesConnectedFrameChrome: CompositorService.usesConnectedFrameChromeForScreen(screen) - readonly property bool connectedBarActiveOnEdge: usesConnectedFrameChrome && !!screen && SettingsData.getActiveBarEdgesForScreen(screen).includes(edge) readonly property real connectedJoinInset: { if (usesConnectedFrameChrome) - return connectedBarActiveOnEdge ? SettingsData.frameBarSize : SettingsData.frameThickness; + return SettingsData.frameEdgeReservation(screen, edge); if (frameExclusionActive) return SettingsData.frameEdgeInsetForSide(screen, edge); return 0; diff --git a/quickshell/Modules/Frame/FrameExclusions.qml b/quickshell/Modules/Frame/FrameExclusions.qml index 1729a02c2..3f7a06363 100644 --- a/quickshell/Modules/Frame/FrameExclusions.qml +++ b/quickshell/Modules/Frame/FrameExclusions.qml @@ -34,7 +34,7 @@ Scope { } function exclusionSizeForEdge(edge) { - return root.barEdges.includes(edge) ? SettingsData.frameBarSize : SettingsData.frameThickness; + return SettingsData.frameEdgeReservation(root.screen, edge); } Loader { diff --git a/quickshell/Modules/Frame/FrameWindow.qml b/quickshell/Modules/Frame/FrameWindow.qml index 1cfd58cf4..7e7134abe 100644 --- a/quickshell/Modules/Frame/FrameWindow.qml +++ b/quickshell/Modules/Frame/FrameWindow.qml @@ -262,10 +262,22 @@ PanelWindow { return false; } - readonly property int cutoutTopInset: win._regionInt(barEdges.includes("top") ? SettingsData.frameBarSize : SettingsData.frameThickness) - readonly property int cutoutBottomInset: win._regionInt(barEdges.includes("bottom") ? SettingsData.frameBarSize : SettingsData.frameThickness) - readonly property int cutoutLeftInset: win._regionInt(barEdges.includes("left") ? SettingsData.frameBarSize : SettingsData.frameThickness) - readonly property int cutoutRightInset: win._regionInt(barEdges.includes("right") ? SettingsData.frameBarSize : SettingsData.frameThickness) + readonly property int cutoutTopInset: { + SettingsData.barConfigs; + return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "top")); + } + readonly property int cutoutBottomInset: { + SettingsData.barConfigs; + return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "bottom")); + } + readonly property int cutoutLeftInset: { + SettingsData.barConfigs; + return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "left")); + } + readonly property int cutoutRightInset: { + SettingsData.barConfigs; + return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "right")); + } readonly property int cutoutWidth: Math.max(0, win._windowRegionWidth - win.cutoutLeftInset - win.cutoutRightInset) readonly property int cutoutHeight: Math.max(0, win._windowRegionHeight - win.cutoutTopInset - win.cutoutBottomInset) readonly property int cutoutRadius: { diff --git a/quickshell/Modules/Notifications/Popup/NotificationPopupManager.qml b/quickshell/Modules/Notifications/Popup/NotificationPopupManager.qml index c96762969..2c8da9e10 100644 --- a/quickshell/Modules/Notifications/Popup/NotificationPopupManager.qml +++ b/quickshell/Modules/Notifications/Popup/NotificationPopupManager.qml @@ -360,8 +360,7 @@ QtObject { function _frameEdgeInset(side) { if (!manager.modelData) return 0; - const edges = SettingsData.getActiveBarEdgesForScreen(manager.modelData); - const raw = edges.includes(side) ? SettingsData.frameBarSize : SettingsData.frameThickness; + const raw = SettingsData.frameEdgeReservation(manager.modelData, side); const dpr = CompositorService.getScreenScale(manager.modelData); return Math.max(0, Math.round(Theme.px(raw, dpr))); } diff --git a/quickshell/Modules/Settings/FrameTab.qml b/quickshell/Modules/Settings/FrameTab.qml index 7832b4393..8c97d0fc7 100644 --- a/quickshell/Modules/Settings/FrameTab.qml +++ b/quickshell/Modules/Settings/FrameTab.qml @@ -13,7 +13,7 @@ Item { LayoutMirroring.childrenInherit: true // Bar Inset Padding: resolve the "auto" sentinel (stored < 0) to the frame thickness for the slider display. - readonly property int frameInsetPaddingDisplay: SettingsData.frameBarInsetPadding < 0 ? Math.round(SettingsData.frameThickness) : SettingsData.frameBarInsetPadding + readonly property int frameInsetPaddingDisplay: Math.round(SettingsData.frameBarContentGap) DankFlickable { anchors.fill: parent diff --git a/quickshell/Widgets/DankPopoutConnected.qml b/quickshell/Widgets/DankPopoutConnected.qml index 0857b905a..144393be9 100644 --- a/quickshell/Widgets/DankPopoutConnected.qml +++ b/quickshell/Widgets/DankPopoutConnected.qml @@ -584,11 +584,9 @@ Item { } function _frameEdgeInset(side) { - if (!root.frameOwnsConnectedChrome || !root.screen) + if (!root.frameOwnsConnectedChrome) return 0; - const edges = SettingsData.getActiveBarEdgesForScreen(root.screen); - const raw = edges.includes(side) ? SettingsData.frameBarSize : SettingsData.frameThickness; - return Math.max(0, raw); + return Math.max(0, SettingsData.frameEdgeReservation(root.screen, side)); } function _edgeGapFor(side, popupGap) {