1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

dankbar: add click-through option

This commit is contained in:
bbedward
2026-01-18 14:22:41 -05:00
parent 1adbf3937b
commit f313d03348
8 changed files with 132 additions and 18 deletions

View File

@@ -296,6 +296,9 @@ Item {
width: parent.width
anchors.centerIn: parent
implicitWidth: isVertical ? widgetThickness : totalSize
implicitHeight: isVertical ? totalSize : widgetThickness
Timer {
id: layoutTimer
interval: 0

View File

@@ -20,6 +20,13 @@ Item {
readonly property real innerPadding: barConfig?.innerPadding ?? 4
property alias hLeftSection: hLeftSection
property alias hCenterSection: hCenterSection
property alias hRightSection: hRightSection
property alias vLeftSection: vLeftSection
property alias vCenterSection: vCenterSection
property alias vRightSection: vRightSection
anchors.fill: parent
anchors.leftMargin: Math.max(Theme.spacingXS, innerPadding * 0.8)
anchors.rightMargin: Math.max(Theme.spacingXS, innerPadding * 0.8)

View File

@@ -500,8 +500,78 @@ PanelWindow {
height: axis.isVertical ? parent.height : maskThickness
}
readonly property bool clickThroughEnabled: barConfig?.clickThrough ?? false
readonly property var _leftSection: topBarContent ? (barWindow.isVertical ? topBarContent.vLeftSection : topBarContent.hLeftSection) : null
readonly property var _centerSection: topBarContent ? (barWindow.isVertical ? topBarContent.vCenterSection : topBarContent.hCenterSection) : null
readonly property var _rightSection: topBarContent ? (barWindow.isVertical ? topBarContent.vRightSection : topBarContent.hRightSection) : null
function sectionRect(section, isCenter) {
if (!section)
return {
"x": 0,
"y": 0,
"w": 0,
"h": 0
};
const pos = section.mapToItem(barWindow.contentItem, 0, 0);
const implW = section.implicitWidth || 0;
const implH = section.implicitHeight || 0;
const offsetX = isCenter && !barWindow.isVertical ? (section.width - implW) / 2 : 0;
const offsetY = !barWindow.isVertical ? (section.height - implH) / 2 : (isCenter ? (section.height - implH) / 2 : 0);
const edgePad = 2;
return {
"x": pos.x + offsetX - edgePad,
"y": pos.y + offsetY - edgePad,
"w": implW + edgePad * 2,
"h": implH + edgePad * 2
};
}
mask: Region {
item: inputMask
item: clickThroughEnabled ? null : inputMask
Region {
readonly property var r: barWindow.clickThroughEnabled ? barWindow.sectionRect(barWindow._leftSection, false) : {
"x": 0,
"y": 0,
"w": 0,
"h": 0
}
x: r.x
y: r.y
width: r.w
height: r.h
}
Region {
readonly property var r: barWindow.clickThroughEnabled ? barWindow.sectionRect(barWindow._centerSection, true) : {
"x": 0,
"y": 0,
"w": 0,
"h": 0
}
x: r.x
y: r.y
width: r.w
height: r.h
}
Region {
readonly property var r: barWindow.clickThroughEnabled ? barWindow.sectionRect(barWindow._rightSection, false) : {
"x": 0,
"y": 0,
"w": 0,
"h": 0
}
x: r.x
y: r.y
width: r.w
height: r.h
}
}
Item {

View File

@@ -731,7 +731,8 @@ Item {
Flow {
id: workspaceRow
anchors.centerIn: parent
x: isVertical ? visualBackground.x : (parent.width - implicitWidth) / 2
y: isVertical ? (parent.height - implicitHeight) / 2 : visualBackground.y
spacing: Theme.spacingS
flow: isVertical ? Flow.TopToBottom : Flow.LeftToRight
@@ -993,12 +994,13 @@ Item {
dataUpdateTimer.restart();
}
width: root.isVertical ? root.barThickness : visualWidth
height: root.isVertical ? visualHeight : root.barThickness
width: root.isVertical ? root.widgetHeight : visualWidth
height: root.isVertical ? visualHeight : root.widgetHeight
Rectangle {
id: focusedBorderRing
anchors.centerIn: parent
x: root.isVertical ? (root.widgetHeight - width) / 2 : (parent.width - width) / 2
y: root.isVertical ? (parent.height - height) / 2 : (root.widgetHeight - height) / 2
width: {
const borderWidth = (SettingsData.workspaceFocusedBorderEnabled && isActive && !isPlaceholder) ? SettingsData.workspaceFocusedBorderThickness : 0;
return delegateRoot.visualWidth + borderWidth * 2;
@@ -1045,7 +1047,8 @@ Item {
id: visualContent
width: delegateRoot.visualWidth
height: delegateRoot.visualHeight
anchors.centerIn: parent
x: root.isVertical ? (root.widgetHeight - width) / 2 : (parent.width - width) / 2
y: root.isVertical ? (parent.height - height) / 2 : (root.widgetHeight - height) / 2
radius: Theme.cornerRadius
color: isActive ? activeColor : isUrgent ? urgentColor : isPlaceholder ? Theme.surfaceTextLight : isHovered ? Theme.withAlpha(unfocusedColor, 0.7) : isOccupied ? occupiedColor : unfocusedColor