background: fix visualiser blur + allow disable

Fixes #807
This commit is contained in:
2 * r + 2 * t 2025-10-21 14:05:06 +11:00
parent 84343dde62
commit 8a46b63a55
4 changed files with 63 additions and 49 deletions

View file

@ -306,6 +306,7 @@ default, you must create it manually.
},
"enabled": true,
"visualiser": {
"blur": false,
"enabled": false,
"autoHide": true,
"rounding": 1,

View file

@ -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
}

View file

@ -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 {

View file

@ -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
MultiEffect {
opacity: shouldBeActive ? 1 : 0
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
Behavior on anchors.leftMargin {
Anim {}
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
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 {