From cbe086d8350587517891bd3ecf1a985b67b2c97a Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 30 May 2025 09:32:17 +0200 Subject: [PATCH] refractor shadows --- .../quickshell/modules/cheatsheet/Cheatsheet.qml | 9 ++------- .../modules/common/widgets/NotificationGroup.qml | 9 ++------- .../common/widgets/StyledRectangularShadow.qml | 13 +++++++++++++ .config/quickshell/modules/dock/Dock.qml | 9 ++------- .../modules/mediaControls/PlayerControl.qml | 9 ++------- .../modules/onScreenDisplay/OsdValueIndicator.qml | 8 ++------ .../quickshell/modules/overview/OverviewWidget.qml | 8 ++------ .../quickshell/modules/overview/SearchWidget.qml | 8 ++------ .../quickshell/modules/sidebarLeft/SidebarLeft.qml | 8 ++------ .../modules/sidebarLeft/anime/BooruImage.qml | 8 ++------ .../modules/sidebarRight/SidebarRight.qml | 8 ++------ .../modules/sidebarRight/todo/TodoWidget.qml | 7 ++----- 12 files changed, 35 insertions(+), 69 deletions(-) create mode 100644 .config/quickshell/modules/common/widgets/StyledRectangularShadow.qml diff --git a/.config/quickshell/modules/cheatsheet/Cheatsheet.qml b/.config/quickshell/modules/cheatsheet/Cheatsheet.qml index 83af1f00..79711f88 100644 --- a/.config/quickshell/modules/cheatsheet/Cheatsheet.qml +++ b/.config/quickshell/modules/cheatsheet/Cheatsheet.qml @@ -57,13 +57,8 @@ Scope { // Scope // Background - RectangularShadow { - anchors.fill: cheatsheetBackground - radius: cheatsheetBackground.radius - blur: 1.2 * Appearance.sizes.elevationMargin - spread: 1 - color: Appearance.colors.colShadow - cached: true + StyledRectangularShadow { + target: cheatsheetBackground } Rectangle { id: cheatsheetBackground diff --git a/.config/quickshell/modules/common/widgets/NotificationGroup.qml b/.config/quickshell/modules/common/widgets/NotificationGroup.qml index 14669e99..009a0b3e 100644 --- a/.config/quickshell/modules/common/widgets/NotificationGroup.qml +++ b/.config/quickshell/modules/common/widgets/NotificationGroup.qml @@ -105,14 +105,9 @@ Item { // Notification group area } } - - RectangularShadow { + StyledRectangularShadow { + target: background visible: popup - anchors.fill: background - radius: background.radius - blur: 1.2 * Appearance.sizes.elevationMargin - spread: 1 - color: Appearance.colors.colShadow } Rectangle { // Background of the notification id: background diff --git a/.config/quickshell/modules/common/widgets/StyledRectangularShadow.qml b/.config/quickshell/modules/common/widgets/StyledRectangularShadow.qml new file mode 100644 index 00000000..6e1f2e16 --- /dev/null +++ b/.config/quickshell/modules/common/widgets/StyledRectangularShadow.qml @@ -0,0 +1,13 @@ +import QtQuick +import QtQuick.Effects +import "root:/modules/common" + +RectangularShadow { + required property var target + anchors.fill: target + radius: target.radius + blur: 1.2 * Appearance.sizes.elevationMargin + spread: 1 + color: Appearance.colors.colShadow + cached: true +} diff --git a/.config/quickshell/modules/dock/Dock.qml b/.config/quickshell/modules/dock/Dock.qml index 4da45e74..66b5172b 100644 --- a/.config/quickshell/modules/dock/Dock.qml +++ b/.config/quickshell/modules/dock/Dock.qml @@ -75,13 +75,8 @@ Scope { // Scope implicitWidth: dockRow.implicitWidth + 5 * 2 height: parent.height - Appearance.sizes.elevationMargin - Appearance.sizes.hyprlandGapsOut - RectangularShadow { - anchors.fill: dockVisualBackground - radius: dockVisualBackground.radius - blur: 1.2 * Appearance.sizes.elevationMargin - spread: 1 - color: Appearance.colors.colShadow - cached: true + StyledRectangularShadow { + target: dockVisualBackground } Rectangle { id: dockVisualBackground diff --git a/.config/quickshell/modules/mediaControls/PlayerControl.qml b/.config/quickshell/modules/mediaControls/PlayerControl.qml index f2cb59a3..53072690 100644 --- a/.config/quickshell/modules/mediaControls/PlayerControl.qml +++ b/.config/quickshell/modules/mediaControls/PlayerControl.qml @@ -104,13 +104,8 @@ Item { // Player instance } - RectangularShadow { - anchors.fill: background - radius: background.radius - blur: 1.2 * Appearance.sizes.elevationMargin - spread: 1 - color: Appearance.colors.colShadow - cached: true + StyledRectangularShadow { + target: background } Rectangle { // Background id: background diff --git a/.config/quickshell/modules/onScreenDisplay/OsdValueIndicator.qml b/.config/quickshell/modules/onScreenDisplay/OsdValueIndicator.qml index 29829b43..dfbf4a6b 100644 --- a/.config/quickshell/modules/onScreenDisplay/OsdValueIndicator.qml +++ b/.config/quickshell/modules/onScreenDisplay/OsdValueIndicator.qml @@ -25,12 +25,8 @@ Item { implicitWidth: Appearance.sizes.osdWidth implicitHeight: valueIndicator.implicitHeight - RectangularShadow { - anchors.fill: valueIndicator - radius: valueIndicator.radius - blur: 1.2 * Appearance.sizes.elevationMargin - spread: 1 - color: Appearance.colors.colShadow + StyledRectangularShadow { + target: valueIndicator } WrapperRectangle { id: valueIndicator diff --git a/.config/quickshell/modules/overview/OverviewWidget.qml b/.config/quickshell/modules/overview/OverviewWidget.qml index ad4eea02..1b0673f2 100644 --- a/.config/quickshell/modules/overview/OverviewWidget.qml +++ b/.config/quickshell/modules/overview/OverviewWidget.qml @@ -49,12 +49,8 @@ Item { property Component windowComponent: OverviewWindow {} property list windowWidgets: [] - RectangularShadow { // Background shadow - anchors.fill: overviewBackground - radius: overviewBackground.radius - blur: 1.2 * Appearance.sizes.elevationMargin - spread: 1 - color: Appearance.colors.colShadow + StyledRectangularShadow { + target: overviewBackground } Rectangle { // Background id: overviewBackground diff --git a/.config/quickshell/modules/overview/SearchWidget.qml b/.config/quickshell/modules/overview/SearchWidget.qml index a49ae63a..016b8204 100644 --- a/.config/quickshell/modules/overview/SearchWidget.qml +++ b/.config/quickshell/modules/overview/SearchWidget.qml @@ -169,12 +169,8 @@ Item { // Wrapper } } - RectangularShadow { // Background shadow - anchors.fill: searchWidgetContent - radius: searchWidgetContent.radius - blur: 1.2 * Appearance.sizes.elevationMargin - spread: 1 - color: Appearance.colors.colShadow + StyledRectangularShadow { + target: searchWidgetContent } Rectangle { // Background id: searchWidgetContent diff --git a/.config/quickshell/modules/sidebarLeft/SidebarLeft.qml b/.config/quickshell/modules/sidebarLeft/SidebarLeft.qml index a5bb59d6..57c7e6ff 100644 --- a/.config/quickshell/modules/sidebarLeft/SidebarLeft.qml +++ b/.config/quickshell/modules/sidebarLeft/SidebarLeft.qml @@ -65,12 +65,8 @@ Scope { // Scope } // Background - RectangularShadow { // Background shadow - anchors.fill: sidebarLeftBackground - radius: sidebarLeftBackground.radius - blur: 1.2 * Appearance.sizes.elevationMargin - spread: 1 - color: Appearance.colors.colShadow + StyledRectangularShadow { + target: sidebarLeftBackground } Rectangle { id: sidebarLeftBackground diff --git a/.config/quickshell/modules/sidebarLeft/anime/BooruImage.qml b/.config/quickshell/modules/sidebarLeft/anime/BooruImage.qml index 29768cfb..64c5bded 100644 --- a/.config/quickshell/modules/sidebarLeft/anime/BooruImage.qml +++ b/.config/quickshell/modules/sidebarLeft/anime/BooruImage.qml @@ -124,12 +124,8 @@ Button { width: contextMenu.width height: contextMenu.height - RectangularShadow { // Background shadow - anchors.fill: contextMenu - radius: contextMenu.radius - blur: 1.2 * Appearance.sizes.elevationMargin - spread: 1 - color: Appearance.colors.colShadow + StyledRectangularShadow { + target: contextMenu } Rectangle { id: contextMenu diff --git a/.config/quickshell/modules/sidebarRight/SidebarRight.qml b/.config/quickshell/modules/sidebarRight/SidebarRight.qml index d2dfa34a..4f774db6 100644 --- a/.config/quickshell/modules/sidebarRight/SidebarRight.qml +++ b/.config/quickshell/modules/sidebarRight/SidebarRight.qml @@ -60,12 +60,8 @@ Scope { implicitHeight: sidebarRightBackground.implicitHeight implicitWidth: sidebarRightBackground.implicitWidth - RectangularShadow { // Background shadow - anchors.fill: sidebarRightBackground - radius: sidebarRightBackground.radius - blur: 1.2 * Appearance.sizes.elevationMargin - spread: 1 - color: Appearance.colors.colShadow + StyledRectangularShadow { + target: sidebarRightBackground } Rectangle { id: sidebarRightBackground diff --git a/.config/quickshell/modules/sidebarRight/todo/TodoWidget.qml b/.config/quickshell/modules/sidebarRight/todo/TodoWidget.qml index e4f441b5..441a35ca 100644 --- a/.config/quickshell/modules/sidebarRight/todo/TodoWidget.qml +++ b/.config/quickshell/modules/sidebarRight/todo/TodoWidget.qml @@ -152,12 +152,9 @@ Item { } // + FAB - RectangularShadow { // Background shadow - anchors.fill: fabButton + StyledRectangularShadow { + target: fabButton radius: Appearance.rounding.normal - blur: 1.2 * Appearance.sizes.elevationMargin - spread: 1 - color: Appearance.colors.colShadow } Button { id: fabButton