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

dankbar: prevent double widget instances for horiz/vertical

This commit is contained in:
bbedward
2025-10-23 09:30:04 -04:00
parent b2e5565110
commit 85c00a9c4e
5 changed files with 35 additions and 8 deletions

View File

@@ -13,8 +13,10 @@ Item {
property var parentScreen: null
property real widgetThickness: 30
property real barThickness: 48
property bool overrideAxisLayout: false
property bool forceVerticalLayout: false
readonly property bool isVertical: axis?.isVertical ?? false
readonly property bool isVertical: overrideAxisLayout ? forceVerticalLayout : (axis?.isVertical ?? false)
readonly property real spacing: noBackground ? 2 : Theme.spacingXS
property var centerWidgets: []

View File

@@ -585,18 +585,18 @@ Item {
function getWidgetSection(parentItem) {
let current = parentItem
while (current) {
if (current.objectName === "leftSection" || current === hLeftSection || current === vLeftSection) {
if (current.objectName === "leftSection") {
return "left"
}
if (current.objectName === "centerSection" || current === hCenterSection || current === vCenterSection) {
if (current.objectName === "centerSection") {
return "center"
}
if (current.objectName === "rightSection" || current === hRightSection || current === vRightSection) {
if (current.objectName === "rightSection") {
return "right"
}
current = current.parent
}
return "left" // fallback
return "left"
}
readonly property var widgetVisibility: ({
@@ -695,6 +695,9 @@ Item {
LeftSection {
id: hLeftSection
objectName: "leftSection"
overrideAxisLayout: true
forceVerticalLayout: false
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
@@ -710,6 +713,9 @@ Item {
RightSection {
id: hRightSection
objectName: "rightSection"
overrideAxisLayout: true
forceVerticalLayout: false
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
@@ -725,6 +731,9 @@ Item {
CenterSection {
id: hCenterSection
objectName: "centerSection"
overrideAxisLayout: true
forceVerticalLayout: false
anchors {
verticalCenter: parent.verticalCenter
horizontalCenter: parent.horizontalCenter
@@ -746,6 +755,9 @@ Item {
LeftSection {
id: vLeftSection
objectName: "leftSection"
overrideAxisLayout: true
forceVerticalLayout: true
width: parent.width
anchors {
top: parent.top
@@ -762,6 +774,9 @@ Item {
CenterSection {
id: vCenterSection
objectName: "centerSection"
overrideAxisLayout: true
forceVerticalLayout: true
width: parent.width
anchors {
verticalCenter: parent.verticalCenter
@@ -778,6 +793,9 @@ Item {
RightSection {
id: vRightSection
objectName: "rightSection"
overrideAxisLayout: true
forceVerticalLayout: true
width: parent.width
height: implicitHeight
anchors {

View File

@@ -11,8 +11,10 @@ Item {
property var parentScreen: null
property real widgetThickness: 30
property real barThickness: 48
property bool overrideAxisLayout: false
property bool forceVerticalLayout: false
readonly property bool isVertical: axis?.isVertical ?? false
readonly property bool isVertical: overrideAxisLayout ? forceVerticalLayout : (axis?.isVertical ?? false)
implicitHeight: layoutLoader.item ? (layoutLoader.item.implicitHeight || layoutLoader.item.height) : 0
implicitWidth: layoutLoader.item ? (layoutLoader.item.implicitWidth || layoutLoader.item.width) : 0

View File

@@ -11,8 +11,10 @@ Item {
property var parentScreen: null
property real widgetThickness: 30
property real barThickness: 48
property bool overrideAxisLayout: false
property bool forceVerticalLayout: false
readonly property bool isVertical: axis?.isVertical ?? false
readonly property bool isVertical: overrideAxisLayout ? forceVerticalLayout : (axis?.isVertical ?? false)
implicitHeight: layoutLoader.item ? layoutLoader.item.implicitHeight : 0
implicitWidth: layoutLoader.item ? layoutLoader.item.implicitWidth : 0

View File

@@ -18,7 +18,10 @@ Loader {
asynchronous: false
active: getWidgetVisible(widgetId, DgopService.dgopAvailable) &&
readonly property bool orientationMatches: (axis?.isVertical ?? false) === isInColumn
active: orientationMatches &&
getWidgetVisible(widgetId, DgopService.dgopAvailable) &&
(widgetId !== "music" || MprisController.activePlayer !== null)
sourceComponent: getWidgetComponent(widgetId, components)
opacity: getWidgetEnabled(widgetData?.enabled) ? 1 : 0