From d448b76dd4cfef56576ec7475e1e181d7fd8ea52 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 11 Aug 2025 22:42:14 +0700 Subject: [PATCH] fix stuff not getting blurred when transparency is enabled --- .../ii/modules/common/functions/ColorUtils.qml | 13 +++++++++++++ .../ii/modules/common/widgets/NotificationGroup.qml | 2 +- .../ii/modules/common/widgets/StyledPopup.qml | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.config/quickshell/ii/modules/common/functions/ColorUtils.qml b/.config/quickshell/ii/modules/common/functions/ColorUtils.qml index 27d48187a..15c4280a9 100644 --- a/.config/quickshell/ii/modules/common/functions/ColorUtils.qml +++ b/.config/quickshell/ii/modules/common/functions/ColorUtils.qml @@ -111,4 +111,17 @@ Singleton { var c = Qt.color(color); return Qt.rgba(c.r, c.g, c.b, c.a * (1 - percentage)); } + + /** + * Sets the alpha channel of a color. + * + * @param {string} color - The base color (any Qt.color-compatible string). + * @param {number} alpha - The desired alpha (0-1). + * @returns {Qt.rgba} The resulting color with applied alpha. + */ + function applyAlpha(color, alpha) { + var c = Qt.color(color); + var a = Math.max(0, Math.min(1, alpha)); + return Qt.rgba(c.r, c.g, c.b, a); + } } diff --git a/.config/quickshell/ii/modules/common/widgets/NotificationGroup.qml b/.config/quickshell/ii/modules/common/widgets/NotificationGroup.qml index fbdc44daf..592f18a6c 100644 --- a/.config/quickshell/ii/modules/common/widgets/NotificationGroup.qml +++ b/.config/quickshell/ii/modules/common/widgets/NotificationGroup.qml @@ -105,7 +105,7 @@ Item { // Notification group area id: background anchors.left: parent.left width: parent.width - color: Appearance.colors.colLayer2 + color: popup ? ColorUtils.applyAlpha(Appearance.colors.colLayer2, 1 - Appearance.backgroundTransparency) : Appearance.colors.colLayer2 radius: Appearance.rounding.normal anchors.leftMargin: root.xOffset diff --git a/.config/quickshell/ii/modules/common/widgets/StyledPopup.qml b/.config/quickshell/ii/modules/common/widgets/StyledPopup.qml index af5c0ae5c..164c9217c 100644 --- a/.config/quickshell/ii/modules/common/widgets/StyledPopup.qml +++ b/.config/quickshell/ii/modules/common/widgets/StyledPopup.qml @@ -1,4 +1,5 @@ import qs.modules.common +import qs.modules.common.functions import QtQuick import QtQuick.Effects import Quickshell @@ -54,7 +55,7 @@ LazyLoader { anchors.centerIn: parent implicitWidth: root.contentItem.implicitWidth + margin * 2 implicitHeight: root.contentItem.implicitHeight + margin * 2 - color: Appearance.colors.colSurfaceContainer + color: ColorUtils.applyAlpha(Appearance.colors.colSurfaceContainer, 1 - Appearance.backgroundTransparency) radius: Appearance.rounding.small children: [root.contentItem]