summaryrefslogtreecommitdiff
path: root/modules/detachedcontent/DetachedContent.qml
blob: cf564cba3f4c6eb4d1d6b7dfcfb859ef4b8875df (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
pragma ComponentBehavior: Bound

import qs.components
import qs.components.controls
import qs.services
import qs.config
import Quickshell
import QtQuick
import QtQuick.Layouts

Item {
    id: root

    required property ShellScreen screen
    property alias active: session.active
    readonly property Session session: Session {
        id: session
    }

    implicitWidth: implicitHeight * Config.dcontent.sizes.ratio
    implicitHeight: screen.height * Config.dcontent.sizes.heightMult

    RowLayout {
        anchors.fill: parent

        spacing: 0

        StyledRect {
            Layout.fillHeight: true

            topLeftRadius: Appearance.rounding.normal
            bottomLeftRadius: Appearance.rounding.normal
            implicitWidth: navRail.implicitWidth
            color: Colours.palette.m3surfaceContainer

            CustomMouseArea {
                anchors.fill: parent

                function onWheel(event: WheelEvent): void {
                    if (event.angleDelta.y < 0)
                        root.session.activeIndex = Math.min(root.session.activeIndex + 1, root.session.panes.length - 1);
                    else if (event.angleDelta.y > 0)
                        root.session.activeIndex = Math.max(root.session.activeIndex - 1, 0);
                }
            }

            NavRail {
                id: navRail

                session: root.session
            }
        }

        Panes {
            Layout.fillWidth: true
            Layout.fillHeight: true

            session: root.session
        }
    }
}