summaryrefslogtreecommitdiff
path: root/modules/background/Border.qml
blob: 752a814f67fe82d20e7227ba5b3aa9555680dafa (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
import "root:/widgets"
import "root:/config"
import Quickshell
import QtQuick
import QtQuick.Effects

StyledWindow {
    id: win

    name: "border"
    exclusionMode: ExclusionMode.Ignore

    mask: Region {
        x: BackgroundConfig.border.thickness
        y: BackgroundConfig.border.thickness
        width: win.screen.width - BackgroundConfig.border.thickness * 2
        height: win.screen.height - BackgroundConfig.border.thickness * 2
        intersection: Intersection.Xor
    }

    anchors.top: true
    anchors.bottom: true
    anchors.left: true
    anchors.right: true

    StyledRect {
        id: rect

        anchors.fill: parent
        color: Appearance.alpha(Appearance.colours.m3surface, false)
        visible: false
    }

    Item {
        id: mask

        anchors.fill: parent
        layer.enabled: true
        visible: false

        Rectangle {
            anchors.fill: parent
            anchors.margins: BackgroundConfig.border.thickness
            radius: BackgroundConfig.border.rounding
        }
    }

    MultiEffect {
        anchors.fill: parent
        maskEnabled: true
        maskInverted: true
        maskSource: mask
        source: rect
        maskThresholdMin: 0.5
        maskSpreadAtMin: 1
    }
}