mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-05 21:15:38 -05:00
dankbar: shrink to 0 spacing and no border when maximized surface is
present
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Shapes
|
import QtQuick.Shapes
|
||||||
import qs.Common
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -13,7 +14,7 @@ Item {
|
|||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.top: parent.top
|
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.leftMargin: -(gothEnabled && axis.isVertical && axis.edge === "right" ? barWindow._wingR : 0)
|
||||||
anchors.rightMargin: -(gothEnabled && axis.isVertical && axis.edge === "left" ? 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)
|
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 isLeft: barPos === SettingsData.Position.Left
|
||||||
readonly property bool isRight: barPos === SettingsData.Position.Right
|
readonly property bool isRight: barPos === SettingsData.Position.Right
|
||||||
|
|
||||||
readonly property real wing: gothEnabled ? barWindow._wingR : 0
|
property real wing: gothEnabled ? barWindow._wingR : 0
|
||||||
readonly property real rt: (barConfig?.squareCorners ?? false) ? 0 : Theme.cornerRadius
|
|
||||||
|
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 mainPath: generatePathForPosition(width, height)
|
||||||
readonly property string borderFullPath: generateBorderFullPath(width, height)
|
readonly property string borderFullPath: generateBorderFullPath(width, height)
|
||||||
@@ -70,7 +94,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: barShape
|
id: barShape
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -96,8 +119,9 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
active: borderFullPathCorrectShape && borderEdgePathCorrectShape
|
active: borderFullPathCorrectShape && borderEdgePathCorrectShape
|
||||||
|
|
||||||
readonly property real borderThickness: Math.max(1, barConfig?.borderThickness ?? 1)
|
readonly property real _scale: CompositorService.getScreenScale(barWindow.screen)
|
||||||
readonly property real inset: showFullBorder ? Math.ceil(borderThickness / 2) : borderThickness / 2
|
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 string borderColorKey: barConfig?.borderColor || "surfaceText"
|
||||||
readonly property color baseColor: (borderColorKey === "surfaceText") ? Theme.surfaceText : (borderColorKey === "primary") ? Theme.primary : Theme.secondary
|
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)
|
readonly property color borderColor: Theme.withAlpha(baseColor, barConfig?.borderOpacity ?? 1.0)
|
||||||
@@ -106,7 +130,7 @@ Item {
|
|||||||
id: barBorderShape
|
id: barBorderShape
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
preferredRendererType: Shape.CurveRenderer
|
preferredRendererType: Shape.CurveRenderer
|
||||||
visible: barConfig?.borderEnabled ?? false
|
visible: (barConfig?.borderEnabled ?? false) && !barWindow.hasMaximizedToplevel
|
||||||
|
|
||||||
ShapePath {
|
ShapePath {
|
||||||
fillColor: "transparent"
|
fillColor: "transparent"
|
||||||
|
|||||||
@@ -147,6 +147,29 @@ PanelWindow {
|
|||||||
readonly property real _dpr: CompositorService.getScreenScale(barWindow.screen)
|
readonly property real _dpr: CompositorService.getScreenScale(barWindow.screen)
|
||||||
|
|
||||||
property string screenName: modelData.name
|
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 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 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)
|
readonly property real widgetThickness: Math.max(20, 26 + (barConfig?.innerPadding ?? 4) * 0.6)
|
||||||
@@ -247,8 +270,8 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
screen: modelData
|
screen: modelData
|
||||||
implicitHeight: !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 + (barConfig?.spacing ?? 4) + ((barConfig?.gothCornersEnabled ?? false) ? _wingR : 0), _dpr) : 0
|
implicitWidth: isVertical ? Theme.px(effectiveBarThickness + effectiveSpacing + ((barConfig?.gothCornersEnabled ?? false) && !hasMaximizedToplevel ? _wingR : 0), _dpr) : 0
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
property var nativeInhibitor: null
|
property var nativeInhibitor: null
|
||||||
@@ -359,7 +382,6 @@ PanelWindow {
|
|||||||
target: SessionData
|
target: SessionData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
readonly property int barPos: barConfig?.position ?? 0
|
readonly property int barPos: barConfig?.position ?? 0
|
||||||
|
|
||||||
anchors.top: !isVertical ? (barPos === SettingsData.Position.Top) : true
|
anchors.top: !isVertical ? (barPos === SettingsData.Position.Top) : true
|
||||||
@@ -367,12 +389,12 @@ PanelWindow {
|
|||||||
anchors.left: !isVertical ? true : (barPos === SettingsData.Position.Left)
|
anchors.left: !isVertical ? true : (barPos === SettingsData.Position.Left)
|
||||||
anchors.right: !isVertical ? true : (barPos === SettingsData.Position.Right)
|
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 {
|
Item {
|
||||||
id: inputMask
|
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 inOverviewWithShow: CompositorService.isNiri && NiriService.inOverview && (barConfig?.openOnOverview ?? false)
|
||||||
readonly property bool effectiveVisible: (barConfig?.visible ?? true) || inOverviewWithShow
|
readonly property bool effectiveVisible: (barConfig?.visible ?? true) || inOverviewWithShow
|
||||||
@@ -510,8 +532,8 @@ PanelWindow {
|
|||||||
id: topBarMouseArea
|
id: topBarMouseArea
|
||||||
y: !barWindow.isVertical ? (barPos === SettingsData.Position.Bottom ? parent.height - height : 0) : 0
|
y: !barWindow.isVertical ? (barPos === SettingsData.Position.Bottom ? parent.height - height : 0) : 0
|
||||||
x: barWindow.isVertical ? (barPos === SettingsData.Position.Right ? parent.width - width : 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
|
height: !barWindow.isVertical ? Theme.px(barWindow.effectiveBarThickness + barWindow.effectiveSpacing, barWindow._dpr) : undefined
|
||||||
width: barWindow.isVertical ? Theme.px(barWindow.effectiveBarThickness + (barConfig?.spacing ?? 4), barWindow._dpr) : undefined
|
width: barWindow.isVertical ? Theme.px(barWindow.effectiveBarThickness + barWindow.effectiveSpacing, barWindow._dpr) : undefined
|
||||||
anchors {
|
anchors {
|
||||||
left: !barWindow.isVertical ? parent.left : (barPos === SettingsData.Position.Left ? parent.left : undefined)
|
left: !barWindow.isVertical ? parent.left : (barPos === SettingsData.Position.Left ? parent.left : undefined)
|
||||||
right: !barWindow.isVertical ? parent.right : (barPos === SettingsData.Position.Right ? parent.right : undefined)
|
right: !barWindow.isVertical ? parent.right : (barPos === SettingsData.Position.Right ? parent.right : undefined)
|
||||||
@@ -549,7 +571,7 @@ PanelWindow {
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: barUnitInset
|
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.fill: parent
|
||||||
anchors.leftMargin: !barWindow.isVertical ? spacingPx : (axis.edge === "left" ? spacingPx : 0)
|
anchors.leftMargin: !barWindow.isVertical ? spacingPx : (axis.edge === "left" ? spacingPx : 0)
|
||||||
anchors.rightMargin: !barWindow.isVertical ? spacingPx : (axis.edge === "right" ? spacingPx : 0)
|
anchors.rightMargin: !barWindow.isVertical ? spacingPx : (axis.edge === "right" ? spacingPx : 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user