diff --git a/package/contents/ui/code/utils.js b/package/contents/ui/code/utils.js index 0ee9e97..ca470aa 100644 --- a/package/contents/ui/code/utils.js +++ b/package/contents/ui/code/utils.js @@ -246,9 +246,6 @@ function getEffectiveSettings(customSettings, globalSettings) { } } } - if (!effectiveSettings.hasOwnProperty("blurBehind") || !effectiveSettings.blurBehind) { - effectiveSettings.blurBehind = globalSettings.blurBehind; - } return effectiveSettings } diff --git a/package/contents/ui/components/FormWidgetSettings.qml b/package/contents/ui/components/FormWidgetSettings.qml index ea3c536..05ba463 100644 --- a/package/contents/ui/components/FormWidgetSettings.qml +++ b/package/contents/ui/components/FormWidgetSettings.qml @@ -80,12 +80,10 @@ ColumnLayout { } } RowLayout { - visible: keyName !== "" Label { - text: i18n("Blur behind:") + text: i18n("Blur behind (Beta):") } CheckBox { - Kirigami.FormData.label: i18n("Blur behind:") id: blurCheckbox checked: configLocal.blurBehind onCheckedChanged: { @@ -97,7 +95,7 @@ ColumnLayout { enabled: isEnabled.checked } Kirigami.ContextualHelpButton { - toolTipText: i18n("Draw a custom blur mask behind the custom background(s).\n\nNative panel background must be enabled with opacity of 0 for this to work as intended.") + toolTipText: i18n("Draw a custom blur mask behind the custom background(s).\n\nRequires the C++ plugin to work, check the repository README on GitHub for details.\n\nNative panel background must be enabled with opacity of 0 for this to work as intended.") } } RowLayout { diff --git a/package/contents/ui/configPerWidget.qml b/package/contents/ui/configPerWidget.qml index b98a9a5..1908721 100644 --- a/package/contents/ui/configPerWidget.qml +++ b/package/contents/ui/configPerWidget.qml @@ -246,7 +246,7 @@ KCM.SimpleKCM { } Button { icon.name: "checkmark-symbolic" - text: "Apply" + text: "Rename" onClicked: { configOverrides[nameField.text] = configOverrides[overrideName] delete configOverrides[overrideName] @@ -265,7 +265,7 @@ KCM.SimpleKCM { } } Kirigami.ContextualHelpButton { - toolTipText: i18n("Fallback to the global widget settings for disabled options, except for Enable.") + toolTipText: i18n("Fallback to the global widget settings for disabled options, except for Enable and Blur.") } } } diff --git a/package/contents/ui/main.qml b/package/contents/ui/main.qml index c499d9c..3994cb1 100644 --- a/package/contents/ui/main.qml +++ b/package/contents/ui/main.qml @@ -48,6 +48,16 @@ PlasmoidItem { "touchingWindow": !panelElement ? false : Boolean(panelElement.touchingWindow), "floating": !panelElement ? false : Boolean(panelElement.floatingness) } + property var widgetsDoingBlur: ({}) + property var trayItemsDoingBlur: ({}) + + property var anyWidgetDoingBlur: { + return Object.values(widgetsDoingBlur).some(state => state) + } + property var anyTrayItemDoingBlur: { + return Object.values(trayItemsDoingBlur).some(state => state) + } + property var cfg: { try { return JSON.parse(plasmoid.configuration.allSettings) @@ -243,8 +253,13 @@ PlasmoidItem { id: rect property Item target property int targetIndex - // we need an exra id so we can track the items in tray - property int maskIndex: inTray ? (panelLayoutCount -1 + targetIndex) : targetIndex + // use an exra id so we can track the panel and items in tray separately + property int maskIndex: { + if (isPanel) return 0 + else { + return (inTray ? (panelLayoutCount -1 + targetIndex) : targetIndex) +1 + } + } property int itemType property bool isPanel: itemType === Enums.ItemType.PanelBgItem property bool isWidget: itemType === Enums.ItemType.WidgetItem @@ -296,8 +311,9 @@ PlasmoidItem { property bool fgShadowEnabled: cfg.shadow.foreground.enabled && cfgEnabled property var fgShadow: cfg.shadow.foreground property bool blurBehind: { - return isPanel || (isWidget && !panelBgItem?.blurBehind) - || (inTray && !panelBgItem?.blurBehind && !trayWidgetBgItem?.blurBehind) + return (isPanel && !anyWidgetDoingBlur && !anyTrayItemDoingBlur) + || (isWidget) + || (inTray && !trayWidgetBgItem?.blurBehind) ? cfg.blurBehind : false } @@ -805,7 +821,7 @@ PlasmoidItem { } } Label { - text: parseInt(position.x)+","+parseInt(position.y) + text: blurBehind+","+anyWidgetDoingBlur //parseInt(position.x)+","+parseInt(position.y) font.pixelSize: 8 Rectangle { anchors.fill: parent @@ -884,21 +900,30 @@ PlasmoidItem { updateMask() } + onBlurBehindChanged: { + if (isWidget) { + widgetsDoingBlur[maskIndex] = blurBehind + anyWidgetDoingBlur = Object.values(widgetsDoingBlur).some(state => state) + } else if (inTray) { + trayItemsDoingBlur[maskIndex] = blurBehind + anyTrayItemDoingBlur = Object.values(trayItemsDoingBlur).some(state => state) + } + updateMask() + } + function updateMask() { - // Qt.callLater(function() { - if (panelColorizer === null || !blurBehind) return - panelColorizer.updatePanelMask( - maskIndex, - borderRec, - rect.corners.topLeftRadius, - rect.corners.topRightRadius, - rect.corners.bottomLeftRadius, - rect.corners.bottomRightRadius, - Qt.point(rect.positionX-moveX, rect.positionY-moveY), - 5, - visible - ) - // }) + if (panelColorizer === null) return + panelColorizer.updatePanelMask( + maskIndex, + borderRec, + rect.corners.topLeftRadius, + rect.corners.topRightRadius, + rect.corners.bottomLeftRadius, + rect.corners.bottomRightRadius, + Qt.point(rect.positionX-moveX, rect.positionY-moveY), + 5, + visible && blurBehind + ) } } @@ -968,7 +993,7 @@ PlasmoidItem { property: "panelMask" value: blurMask when: (panelColorizer !== null && blurMask && panelColorizer?.hasRegions - && (panelBgItem?.blurBehind || widgetSettings?.blurBehind || trayWidgetSettings?.blurBehind) + && (panelSettings.blurBehind || anyWidgetDoingBlur || anyTrayItemDoingBlur) ) }