summaryrefslogtreecommitdiff
path: root/qml/SystrayView.qml
blob: 3b211526f98f6be1cc0a5d86b9341429668f9e1d (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
import QtQuick
import QtQuick.Controls
import QtWayland.Compositor
import org.kazoe.desktop
import org.kazoe.xdg

ListView {
    id: systrayView
    width: systrayView.contentWidth
    orientation: ListView.Horizontal
    model: systray
    delegate: Item {
        id: trayitem

        Component.onCompleted: {
            var qmlcode
            var c
            if(exec.startsWith("qml://")) {
                var ur = exec.split("/")
                qmlcode = "import " + ur[2] + " " + ur[3] + "; " + ur[4] + " {}"
                c = Qt.createQmlObject(qmlcode, trayitem, ur[4])
            }
            else
            {
                console.debug("Item not supported for systray:" + exec)
            }

            trayitem.width = Qt.binding(() => {return c.width})
            trayitem.height = Qt.binding(() => {return c.height})
        }
    }
}