From 8a46b63a557ef026c4e69b6ebf3498db7c2dfdd8 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Tue, 21 Oct 2025 14:05:06 +1100 Subject: background: fix visualiser blur + allow disable Fixes #807 --- README.md | 1 + config/BackgroundConfig.qml | 1 + modules/background/Background.qml | 25 ++---------- modules/background/Visualiser.qml | 85 ++++++++++++++++++++++++++------------- 4 files changed, 63 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 747c2d9..738fea1 100644 --- a/README.md +++ b/README.md @@ -306,6 +306,7 @@ default, you must create it manually. }, "enabled": true, "visualiser": { + "blur": false, "enabled": false, "autoHide": true, "rounding": 1, diff --git a/config/BackgroundConfig.qml b/config/BackgroundConfig.qml index af46053..ec6b299 100644 --- a/config/BackgroundConfig.qml +++ b/config/BackgroundConfig.qml @@ -12,6 +12,7 @@ JsonObject { component Visualiser: JsonObject { property bool enabled: false property bool autoHide: true + property bool blur: false property real rounding: 1 property real spacing: 1 } diff --git a/modules/background/Background.qml b/modules/background/Background.qml index bdba570..fbacfab 100644 --- a/modules/background/Background.qml +++ b/modules/background/Background.qml @@ -35,29 +35,10 @@ Loader { id: wallpaper } - Loader { - readonly property bool shouldBeActive: Config.background.visualiser.enabled && (!Config.background.visualiser.autoHide || Hypr.monitorFor(win.modelData).activeWorkspace.toplevels.values.every(t => t.lastIpcObject.floating)) ? 1 : 0 - property real offset: shouldBeActive ? 0 : win.modelData.height * 0.2 - + Visualiser { anchors.fill: parent - anchors.topMargin: offset - anchors.bottomMargin: -offset - opacity: shouldBeActive ? 1 : 0 - active: opacity > 0 - asynchronous: true - - sourceComponent: Visualiser { - screen: win.modelData - wallpaper: wallpaper - } - - Behavior on offset { - Anim {} - } - - Behavior on opacity { - Anim {} - } + screen: win.modelData + wallpaper: wallpaper } Loader { diff --git a/modules/background/Visualiser.qml b/modules/background/Visualiser.qml index e5a8a9b..f6020da 100644 --- a/modules/background/Visualiser.qml +++ b/modules/background/Visualiser.qml @@ -15,19 +15,24 @@ Item { required property ShellScreen screen required property Wallpaper wallpaper - ServiceRef { - service: Audio.cava - } + readonly property bool shouldBeActive: Config.background.visualiser.enabled && (!Config.background.visualiser.autoHide || Hypr.monitorFor(screen).activeWorkspace.toplevels.values.every(t => t.lastIpcObject.floating)) + property real offset: shouldBeActive ? 0 : screen.height * 0.2 + + opacity: shouldBeActive ? 1 : 0 - MultiEffect { + Loader { anchors.fill: parent - source: root.wallpaper - maskSource: wrapper - maskEnabled: true - blurEnabled: true - blur: 1 - blurMax: 32 - autoPaddingEnabled: false + active: root.opacity > 0 && Config.background.visualiser.blur + + sourceComponent: MultiEffect { + source: root.wallpaper + maskSource: wrapper + maskEnabled: true + blurEnabled: true + blur: 1 + blurMax: 32 + autoPaddingEnabled: false + } } Item { @@ -36,27 +41,53 @@ Item { anchors.fill: parent layer.enabled: true - Item { - id: content - + Loader { anchors.fill: parent - anchors.margins: Config.border.thickness - anchors.leftMargin: Visibilities.bars.get(root.screen).exclusiveZone + Appearance.spacing.small * Config.background.visualiser.spacing + anchors.topMargin: root.offset + anchors.bottomMargin: -root.offset - Side {} - Side { - isRight: true - } + active: root.opacity > 0 + + sourceComponent: Item { + ServiceRef { + service: Audio.cava + } + + Item { + id: content + + anchors.fill: parent + anchors.margins: Config.border.thickness + anchors.leftMargin: Visibilities.bars.get(root.screen).exclusiveZone + Appearance.spacing.small * Config.background.visualiser.spacing - Behavior on anchors.leftMargin { - Anim {} + Side { + content: content + } + Side { + content: content + isRight: true + } + + Behavior on anchors.leftMargin { + Anim {} + } + } } } } + Behavior on offset { + Anim {} + } + + Behavior on opacity { + Anim {} + } + component Side: Repeater { id: side + required property Item content property bool isRight model: Config.services.visualiserBars @@ -69,11 +100,11 @@ Item { clip: true - x: modelData * ((content.width * 0.4) / Config.services.visualiserBars) + (side.isRight ? content.width * 0.6 : 0) - implicitWidth: (content.width * 0.4) / Config.services.visualiserBars - Appearance.spacing.small * Config.background.visualiser.spacing + x: modelData * ((side.content.width * 0.4) / Config.services.visualiserBars) + (side.isRight ? side.content.width * 0.6 : 0) + implicitWidth: (side.content.width * 0.4) / Config.services.visualiserBars - Appearance.spacing.small * Config.background.visualiser.spacing - y: content.height - height - implicitHeight: bar.value * content.height * 0.4 + y: side.content.height - height + implicitHeight: bar.value * side.content.height * 0.4 color: "transparent" topLeftRadius: Appearance.rounding.small * Config.background.visualiser.rounding @@ -107,7 +138,7 @@ Item { anchors.left: parent.left anchors.right: parent.right y: parent.height - height - implicitHeight: content.height * 0.4 + implicitHeight: side.content.height * 0.4 } Behavior on value { -- cgit v1.2.3-freya