summaryrefslogtreecommitdiff
path: root/launcher/components/SelectionState.qml
blob: d945d7076e3211ef3817a1591bce0535c4ffb390 (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
pragma Singleton
import Quickshell
import QtQuick

Singleton {
    property Item selected: null
    property string input: ""
    property int cursorPosition: 0
    property var priorities: []
    property int selectedPriority: 0
    property var widgets: []

    // order them based on widgets(which came from order from config)
    onPrioritiesChanged: {
        // priorities = priorities.filter(item => item.priority === true); // bind loop
        // dunno y ts works w/o triggering a binding loop but okay..
        for (let i = 0; i < priorities.length; i++)
            if (priorities[i].priority !== true)
                priorities.splice(i, 1);

        priorities.sort((a, b) => widgets.indexOf(a) - widgets.indexOf(b));
        priorities.forEach((item, index) => {});
    }

    function clear() {
        selected = null;
    }
}