summaryrefslogtreecommitdiffstats
path: root/home-configuration/config/quickshell/modules/desktop/Wallpaper.qml
blob: 557fef943c4fcadfe4001901d30135781143b51e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import QtQuick
import QtQuick.Effects
import Quickshell
import Quickshell.Wayland
import "../../config.js" as Config

Variants {
    model: Quickshell.screens

    PanelWindow {
        required property var modelData

        property var wallpaper: Config.wallpapers.find(function(w) {
            return w.outputs.indexOf(modelData.name) !== -1
        })

        screen: modelData
        visible: wallpaper !== undefined

        anchors {
            top: true
            bottom: true
            left: true
            right: true
        }

        exclusionMode: ExclusionMode.Ignore

        WlrLayershell.layer: WlrLayer.Background
        WlrLayershell.namespace: "wallpaper"

        Image {
            id: wallpaperImage

            anchors.fill: parent

            source: wallpaper ? wallpaper.path : ""

            fillMode: wallpaper
                ? Image[wallpaper.fillMode]
                : Image.PreserveAspectCrop

            opacity: wallpaper ? wallpaper.opacity : 1.0

            asynchronous: wallpaper
                ? wallpaper.asynchronous
                : true

            cache: wallpaper
                ? wallpaper.cache
                : true
        }

        MultiEffect {
            anchors.fill: wallpaperImage

            source: wallpaperImage

            blurEnabled: wallpaper ? wallpaper.blur > 0 : false
            blur: wallpaper ? wallpaper.blur : 0
        }
    }
}