summaryrefslogtreecommitdiff
path: root/qml/StatusBar.qml
blob: 8f764c034880f36fae588ee6619e6a6203899b0e (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import QtQuick
import QtQuick.Controls
import org.kazoe.desktop
import org.kazoe.xdg

Rectangle {
    id: statusBar
    height: 46
    property int batteryLevelWarning: 15

    anchors.top: parent.top
    anchors.left: parent.left
    anchors.right: parent.right

    gradient: Gradient {
        GradientStop { position: 0.0; color: currentTheme.window }
        GradientStop { position: 1.0; color: currentTheme.window }
    }

    Rectangle {
        id: bottomline
        anchors.bottom: parent.bottom
        anchors.left: parent.left
        anchors.right: parent.right
        height: 1
        width: undefined
        color: "black"
    }

    Button {
        id: backHome
        anchors.top: parent.top
        anchors.left: parent.left
        anchors.bottom: parent.bottom
        height: comp.statusBarHeight
        anchors.margins: 4
        palette.buttonText: "white"
        font.pointSize: 9
        highlighted: comp.showHomepage
        display: AbstractButton.IconOnly

        icon.name: "home"

        background: Rectangle {
            anchors.top: parent.top
            anchors.horizontalCenter: parent.horizontalCenter
            width: backHome.width
            height: backHome.height
            border.color: backHome.highlighted ? currentTheme.highlight : currentTheme.alternateBase
            border.width: backHome.highlighted ? 2 : 1
            radius: 4
            color: currentTheme.mid
        }

        onClicked: {
            comp.showHomepage = true
        }
    }

    ListView {
        id: taskbar
        anchors.left: backHome.right
        anchors.top: parent.top
        anchors.bottom: parent.bottom
        anchors.right: systray.left
        anchors.leftMargin: 4
        anchors.topMargin: 4
        clip: true
        model: entries
        orientation: Qt.Horizontal
        spacing: 4

        delegate: Button {
            id: taskapp
            palette.buttonText: "white"
            font.pointSize: 9
            highlighted: (comp.showHomepage === false) && (manager.currentSurface === wl_surface)

            height: taskbar.height - 4
            display: AbstractButton.TextBesideIcon
            /*
            * TODO: Find app icon with wayland
            icon.name: wl_surface.surface
            icon.color: "#0aa4da"
            */
            Entry {
                id: xdgapp
                desktopFile: "/usr/share/applications/" + appId + ".desktop"
            }
            icon.name: xdgapp.icon
            icon.color: "transparent"

            background: Rectangle {
                anchors.top: parent.top
                anchors.horizontalCenter: parent.horizontalCenter
                width: taskapp.width
                height: taskapp.height
                border.color: taskapp.highlighted ? currentTheme.highlight : currentTheme.alternateBase
                border.width: taskapp.highlighted ? 2 : 1
                radius: 4
                color: currentTheme.mid
            }
            text: title

            onClicked: {
                manager.currentSurface = wl_surface
                comp.showHomepage = false
            }

            Timer {
                id: longPressTimer

                interval: 1000
                repeat: false
                running: false

                onTriggered: {
                    if(manager.currentSurface == wl_surface)
                    {
                        comp.showHomepage = true
                    }

                    entries.stop(pid)
                }
            }

            onPressedChanged: {
                if ( pressed ) {
                    longPressTimer.running = true;
                } else {
                    longPressTimer.running = false;
                }
            }
        }
    }

    Systray {
        id: systray
        anchors.top: parent.top
        anchors.bottom: parent.bottom
        anchors.right: systrayview.left
        anchors.topMargin: 2
        anchors.bottomMargin: 2
        anchors.rightMargin: 2
    }

    SystrayView {
        id: systrayview
        anchors.top: parent.top
        anchors.bottom: parent.bottom
        anchors.right: parent.right
        anchors.topMargin: 2
        anchors.bottomMargin: 2
        anchors.rightMargin: 2

        width: systrayview.contentWidth
        spacing: 1
    }
}