summaryrefslogtreecommitdiff
path: root/modules/bar/popouts/Content.qml
blob: 6b65f56d3c9e9cc9de3e0634487487eda673dd94 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import "root:/services"
import "root:/config"
import Quickshell
import QtQuick

Item {
    id: root

    required property ShellScreen screen

    anchors.centerIn: parent

    implicitWidth: Popouts.hasCurrent ? content.children.find(c => c.shouldBeActive).implicitWidth + Appearance.padding.large * 2 : 0
    implicitHeight: Popouts.hasCurrent ? content.children.find(c => c.shouldBeActive).implicitHeight + Appearance.padding.large * 2 : 0

    Item {
        id: content

        anchors.fill: parent
        anchors.margins: Appearance.padding.large

        clip: true

        Popout {
            name: "activewindow"
            source: "ActiveWindow.qml"
        }

        Popout {
            name: "battery"
            source: "Battery.qml"
        }
    }

    Behavior on implicitWidth {
        Anim {
            easing.bezierCurve: Appearance.anim.curves.emphasized
        }
    }

    Behavior on implicitHeight {
        Anim {
            easing.bezierCurve: Appearance.anim.curves.emphasized
        }
    }

    component Popout: Loader {
        id: popout

        required property string name
        property bool shouldBeActive: Popouts.currentName === name

        anchors.verticalCenter: parent.verticalCenter
        anchors.right: parent.right

        active: shouldBeActive
        asynchronous: true

        // Behavior on active {
        //     SequentialAnimation {
        //         Anim {
        //             target: popout
        //             property: "opacity"
        //             from: popout.shouldBeActive ? 1 : 0
        //             to: popout.shouldBeActive ? 0 : 1
        //             duration: popout.shouldBeActive ? 0 : Appearance.anim.durations.normal
        //         }
        //         PropertyAction {}
        //         Anim {
        //             target: popout
        //             property: "opacity"
        //             from: popout.shouldBeActive ? 0 : 1
        //             to: popout.shouldBeActive ? 1 : 0
        //             duration: popout.shouldBeActive ? Appearance.anim.durations.normal : 0
        //         }
        //     }
        // }
    }

    component Anim: NumberAnimation {
        duration: Appearance.anim.durations.normal
        easing.type: Easing.BezierSpline
        easing.bezierCurve: Appearance.anim.curves.standard
    }
}