blob: 349d9cc457e7ffe487d620e505b6751d4dd025d6 (
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
|
import QtQuick
import Quickshell
import qs.Commons
import qs.Services.UI
import qs.Widgets
NIconButton {
id: root
property var pluginApi: null
property ShellScreen screen
property string widgetId: ""
property string section: ""
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
baseSize: Style.getCapsuleHeightForScreen(screen?.name)
applyUiScale: false
icon: "keyboard"
tooltipText: pluginApi?.tr("barwidget.tooltip")
tooltipDirection: BarService.getTooltipDirection(screen?.name)
customRadius: Style.radiusL
colorBg: Style.capsuleColor
colorFg: Color.mOnSurface
colorBgHover: Color.mHover
colorFgHover: Color.mOnHover
colorBorder: "transparent"
colorBorderHover: "transparent"
border.color: Style.capsuleBorderColor
border.width: Style.capsuleBorderWidth
NPopupContextMenu {
id: contextMenu
model: [
{
"label": pluginApi?.tr("barwidget.open"),
"action": "open-panel",
"icon": "keyboard"
},
{
"label": pluginApi?.tr("barwidget.settings"),
"action": "plugin-settings",
"icon": "settings"
},
]
onTriggered: action => {
contextMenu.close();
PanelService.closeContextMenu(screen);
if (action === "open-panel") {
if (pluginApi) {
pluginApi.openPanel(screen);
}
} else if (action === "plugin-settings") {
if (pluginApi) {
BarService.openPluginSettings(screen, pluginApi.manifest);
}
}
}
}
onClicked: {
if (pluginApi) {
pluginApi.openPanel(screen);
}
}
onRightClicked: {
PanelService.showContextMenu(contextMenu, root, screen);
}
}
|