summaryrefslogtreecommitdiff
path: root/raveos-hyprland-theme/theme-data/dms/PLUGINS/PopoutControlExample/PopoutControlWidget.qml
blob: fdbf89f598e11e04958c8e1b5bb89141a1882e3f (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
import QtQuick
import qs.Common
import qs.Widgets
import qs.Modules.Plugins

PluginComponent {
    id: root

    property var popoutService: null

    property string selectedPopout: pluginData.selectedPopout || "controlCenter"

    property var popoutActions: ({
            "controlCenter": (x, y, w, s, scr) => popoutService?.toggleControlCenter(x, y, w, s, scr),
            "notificationCenter": (x, y, w, s, scr) => popoutService?.toggleNotificationCenter(x, y, w, s, scr),
            "appDrawer": (x, y, w, s, scr) => popoutService?.toggleAppDrawer(x, y, w, s, scr),
            "processList": (x, y, w, s, scr) => popoutService?.toggleProcessList(x, y, w, s, scr),
            "dankDash": (x, y, w, s, scr) => popoutService?.toggleDankDash(0, x, y, w, s, scr),
            "battery": (x, y, w, s, scr) => popoutService?.toggleBattery(x, y, w, s, scr),
            "vpn": (x, y, w, s, scr) => popoutService?.toggleVpn(x, y, w, s, scr),
            "systemUpdate": (x, y, w, s, scr) => popoutService?.toggleSystemUpdate(x, y, w, s, scr),
            "settings": () => popoutService?.openSettings(),
            "clipboardHistory": () => popoutService?.openClipboardHistory(),
            "spotlight": () => popoutService?.toggleDankLauncherV2(),
            "powerMenu": () => popoutService?.togglePowerMenu(),
            "colorPicker": () => popoutService?.showColorPicker(),
            "notepad": () => popoutService?.toggleNotepad()
        })

    property var popoutNames: ({
            "controlCenter": "Control Center",
            "notificationCenter": "Notification Center",
            "appDrawer": "App Drawer",
            "processList": "Process List",
            "dankDash": "DankDash",
            "battery": "Battery Info",
            "vpn": "VPN",
            "systemUpdate": "System Update",
            "settings": "Settings",
            "clipboardHistory": "Clipboard",
            "spotlight": "Spotlight",
            "powerMenu": "Power Menu",
            "colorPicker": "Color Picker",
            "notepad": "Notepad"
        })

    pillClickAction: (x, y, width, section, screen) => {
        if (popoutActions[selectedPopout]) {
            popoutActions[selectedPopout](x, y, width, section, screen);
        }
    }

    horizontalBarPill: Component {
        Row {
            spacing: Theme.spacingXS

            DankIcon {
                name: "widgets"
                color: Theme.primary
                font.pixelSize: Theme.iconSize - 6
                anchors.verticalCenter: parent.verticalCenter
            }

            StyledText {
                text: popoutNames[selectedPopout] || "Popouts"
                color: Theme.primary
                font.pixelSize: Theme.fontSizeMedium
                anchors.verticalCenter: parent.verticalCenter
            }
        }
    }

    verticalBarPill: Component {
        Column {
            spacing: Theme.spacingXS

            DankIcon {
                name: "widgets"
                color: Theme.primary
                font.pixelSize: Theme.iconSize - 6
                anchors.horizontalCenter: parent.horizontalCenter
            }

            StyledText {
                text: popoutNames[selectedPopout] || "Popouts"
                color: Theme.primary
                font.pixelSize: Theme.fontSizeSmall
                anchors.horizontalCenter: parent.horizontalCenter
                horizontalAlignment: Text.AlignHCenter
            }
        }
    }
}