aboutsummaryrefslogtreecommitdiff
path: root/modules/system/quickshell/GlobalState.qml
blob: c657b31eb409d5d82eadf73ea8f4a1a621c79696 (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
pragma Singleton
import QtQuick

QtObject {
    property string activePopup: ""
    property var notificationHistory: []

    function open(name) {
        activePopup = "";
        activePopup = name;
    }

    function close() {
        activePopup = "";
    }

    function toggle(name) {
        if (activePopup === name)
            activePopup = "";
        else
            activePopup = name;
    }

    function addNotification(data) {
        const entry = Object.assign({}, data);
        notificationHistory = [entry].concat(notificationHistory).slice(0, 50);
    }

    function clearNotificationHistory() {
        notificationHistory = [];
    }
}