summaryrefslogtreecommitdiff
path: root/modules/background/Visualiser.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-10-21 14:05:06 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-10-21 14:05:06 +1100
commit8a46b63a557ef026c4e69b6ebf3498db7c2dfdd8 (patch)
tree19439cf32549646ac933a1732b3cdb017c690176 /modules/background/Visualiser.qml
parent[CI] chore: update flake (diff)
downloadcaelestia-shell-8a46b63a557ef026c4e69b6ebf3498db7c2dfdd8.tar.gz
caelestia-shell-8a46b63a557ef026c4e69b6ebf3498db7c2dfdd8.tar.bz2
caelestia-shell-8a46b63a557ef026c4e69b6ebf3498db7c2dfdd8.zip
background: fix visualiser blur + allow disable
Fixes #807
Diffstat (limited to '')
-rw-r--r--modules/background/Visualiser.qml85
1 files changed, 58 insertions, 27 deletions
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 {