diff --git a/quickshell/Modules/DankBar/BarCanvas.qml b/quickshell/Modules/DankBar/BarCanvas.qml index aa45ffac..85c064c6 100644 --- a/quickshell/Modules/DankBar/BarCanvas.qml +++ b/quickshell/Modules/DankBar/BarCanvas.qml @@ -1,6 +1,7 @@ import QtQuick import QtQuick.Shapes import qs.Common +import qs.Services Item { id: root @@ -13,7 +14,7 @@ Item { anchors.left: parent.left anchors.top: parent.top - readonly property bool gothEnabled: barConfig?.gothCornersEnabled ?? false + readonly property bool gothEnabled: (barConfig?.gothCornersEnabled ?? false) && !barWindow.hasMaximizedToplevel anchors.leftMargin: -(gothEnabled && axis.isVertical && axis.edge === "right" ? barWindow._wingR : 0) anchors.rightMargin: -(gothEnabled && axis.isVertical && axis.edge === "left" ? barWindow._wingR : 0) anchors.topMargin: -(gothEnabled && !axis.isVertical && axis.edge === "bottom" ? barWindow._wingR : 0) @@ -25,8 +26,31 @@ Item { readonly property bool isLeft: barPos === SettingsData.Position.Left readonly property bool isRight: barPos === SettingsData.Position.Right - readonly property real wing: gothEnabled ? barWindow._wingR : 0 - readonly property real rt: (barConfig?.squareCorners ?? false) ? 0 : Theme.cornerRadius + property real wing: gothEnabled ? barWindow._wingR : 0 + + Behavior on wing { + enabled: root.width > 0 && root.height > 0 + NumberAnimation { + duration: Theme.shortDuration + easing.type: Easing.OutCubic + } + } + + property real rt: { + if (barConfig?.squareCorners ?? false) + return 0; + if (barWindow.hasMaximizedToplevel) + return 0; + return Theme.cornerRadius; + } + + Behavior on rt { + enabled: root.width > 0 && root.height > 0 + NumberAnimation { + duration: Theme.shortDuration + easing.type: Easing.OutCubic + } + } readonly property string mainPath: generatePathForPosition(width, height) readonly property string borderFullPath: generateBorderFullPath(width, height) @@ -36,18 +60,18 @@ Item { property bool borderEdgePathCorrectShape: false onMainPathChanged: { - if (width > 0 && height > 0){ - root:mainPathCorrectShape = true; + if (width > 0 && height > 0) { + root: mainPathCorrectShape = true; } } onBorderFullPathChanged: { - if (width > 0 && height > 0){ - root:borderFullPathCorrectShape = true; + if (width > 0 && height > 0) { + root: borderFullPathCorrectShape = true; } } onBorderEdgePathChanged: { - if (width > 0 && height > 0){ - root:borderEdgePathCorrectShape = true; + if (width > 0 && height > 0) { + root: borderEdgePathCorrectShape = true; } } @@ -70,7 +94,6 @@ Item { } } - Loader { id: barShape anchors.fill: parent @@ -91,13 +114,14 @@ Item { } } - Loader { + Loader { id: barBorder anchors.fill: parent active: borderFullPathCorrectShape && borderEdgePathCorrectShape - readonly property real borderThickness: Math.max(1, barConfig?.borderThickness ?? 1) - readonly property real inset: showFullBorder ? Math.ceil(borderThickness / 2) : borderThickness / 2 + readonly property real _scale: CompositorService.getScreenScale(barWindow.screen) + readonly property real borderThickness: Theme.px(Math.max(1, barConfig?.borderThickness ?? 1), _scale) + readonly property real inset: borderThickness / 2 readonly property string borderColorKey: barConfig?.borderColor || "surfaceText" readonly property color baseColor: (borderColorKey === "surfaceText") ? Theme.surfaceText : (borderColorKey === "primary") ? Theme.primary : Theme.secondary readonly property color borderColor: Theme.withAlpha(baseColor, barConfig?.borderOpacity ?? 1.0) @@ -106,7 +130,7 @@ Item { id: barBorderShape anchors.fill: parent preferredRendererType: Shape.CurveRenderer - visible: barConfig?.borderEnabled ?? false + visible: (barConfig?.borderEnabled ?? false) && !barWindow.hasMaximizedToplevel ShapePath { fillColor: "transparent" diff --git a/quickshell/Modules/DankBar/DankBarWindow.qml b/quickshell/Modules/DankBar/DankBarWindow.qml index 2cf5044d..872ae207 100644 --- a/quickshell/Modules/DankBar/DankBarWindow.qml +++ b/quickshell/Modules/DankBar/DankBarWindow.qml @@ -147,6 +147,29 @@ PanelWindow { readonly property real _dpr: CompositorService.getScreenScale(barWindow.screen) property string screenName: modelData.name + + readonly property bool hasMaximizedToplevel: { + if (!CompositorService.isHyprland && !CompositorService.isNiri) + return false; + + const filtered = CompositorService.filterCurrentWorkspace(CompositorService.sortedToplevels, screenName); + for (let i = 0; i < filtered.length; i++) { + if (filtered[i]?.maximized) + return true; + } + return false; + } + + property real effectiveSpacing: hasMaximizedToplevel ? 0 : (barConfig?.spacing ?? 4) + + Behavior on effectiveSpacing { + enabled: barWindow.visible + NumberAnimation { + duration: Theme.shortDuration + easing.type: Easing.OutCubic + } + } + readonly property int notificationCount: NotificationService.notifications.length readonly property real effectiveBarThickness: Math.max(barWindow.widgetThickness + (barConfig?.innerPadding ?? 4) + 4, Theme.barHeight - 4 - (8 - (barConfig?.innerPadding ?? 4))) readonly property real widgetThickness: Math.max(20, 26 + (barConfig?.innerPadding ?? 4) * 0.6) @@ -247,8 +270,8 @@ PanelWindow { } screen: modelData - implicitHeight: !isVertical ? Theme.px(effectiveBarThickness + (barConfig?.spacing ?? 4) + ((barConfig?.gothCornersEnabled ?? false) ? _wingR : 0), _dpr) : 0 - implicitWidth: isVertical ? Theme.px(effectiveBarThickness + (barConfig?.spacing ?? 4) + ((barConfig?.gothCornersEnabled ?? false) ? _wingR : 0), _dpr) : 0 + implicitHeight: !isVertical ? Theme.px(effectiveBarThickness + effectiveSpacing + ((barConfig?.gothCornersEnabled ?? false) && !hasMaximizedToplevel ? _wingR : 0), _dpr) : 0 + implicitWidth: isVertical ? Theme.px(effectiveBarThickness + effectiveSpacing + ((barConfig?.gothCornersEnabled ?? false) && !hasMaximizedToplevel ? _wingR : 0), _dpr) : 0 color: "transparent" property var nativeInhibitor: null @@ -359,7 +382,6 @@ PanelWindow { target: SessionData } - readonly property int barPos: barConfig?.position ?? 0 anchors.top: !isVertical ? (barPos === SettingsData.Position.Top) : true @@ -367,12 +389,12 @@ PanelWindow { anchors.left: !isVertical ? true : (barPos === SettingsData.Position.Left) anchors.right: !isVertical ? true : (barPos === SettingsData.Position.Right) - exclusiveZone: (!(barConfig?.visible ?? true) || topBarCore.autoHide) ? -1 : (barWindow.effectiveBarThickness + (barConfig?.spacing ?? 4) + (barConfig?.bottomGap ?? 0)) + exclusiveZone: (!(barConfig?.visible ?? true) || topBarCore.autoHide) ? -1 : (barWindow.effectiveBarThickness + effectiveSpacing + (barConfig?.bottomGap ?? 0)) Item { id: inputMask - readonly property int barThickness: Theme.px(barWindow.effectiveBarThickness + (barConfig?.spacing ?? 4), barWindow._dpr) + readonly property int barThickness: Theme.px(barWindow.effectiveBarThickness + barWindow.effectiveSpacing, barWindow._dpr) readonly property bool inOverviewWithShow: CompositorService.isNiri && NiriService.inOverview && (barConfig?.openOnOverview ?? false) readonly property bool effectiveVisible: (barConfig?.visible ?? true) || inOverviewWithShow @@ -510,8 +532,8 @@ PanelWindow { id: topBarMouseArea y: !barWindow.isVertical ? (barPos === SettingsData.Position.Bottom ? parent.height - height : 0) : 0 x: barWindow.isVertical ? (barPos === SettingsData.Position.Right ? parent.width - width : 0) : 0 - height: !barWindow.isVertical ? Theme.px(barWindow.effectiveBarThickness + (barConfig?.spacing ?? 4), barWindow._dpr) : undefined - width: barWindow.isVertical ? Theme.px(barWindow.effectiveBarThickness + (barConfig?.spacing ?? 4), barWindow._dpr) : undefined + height: !barWindow.isVertical ? Theme.px(barWindow.effectiveBarThickness + barWindow.effectiveSpacing, barWindow._dpr) : undefined + width: barWindow.isVertical ? Theme.px(barWindow.effectiveBarThickness + barWindow.effectiveSpacing, barWindow._dpr) : undefined anchors { left: !barWindow.isVertical ? parent.left : (barPos === SettingsData.Position.Left ? parent.left : undefined) right: !barWindow.isVertical ? parent.right : (barPos === SettingsData.Position.Right ? parent.right : undefined) @@ -549,7 +571,7 @@ PanelWindow { Item { id: barUnitInset - property int spacingPx: Theme.px(barConfig?.spacing ?? 4, barWindow._dpr) + property int spacingPx: Theme.px(barWindow.effectiveSpacing, barWindow._dpr) anchors.fill: parent anchors.leftMargin: !barWindow.isVertical ? spacingPx : (axis.edge === "left" ? spacingPx : 0) anchors.rightMargin: !barWindow.isVertical ? spacingPx : (axis.edge === "right" ? spacingPx : 0)