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:
@@ -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: []
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user