|
1 | 1 | import QtQuick |
2 | 2 | import Quickshell |
3 | | -import qs.Widgets |
4 | 3 | import qs.Commons |
| 4 | +import qs.Widgets |
| 5 | +import qs.Modules.Bar.Extras |
5 | 6 | import qs.Services.UI |
6 | 7 |
|
7 | | -NIconButton { |
| 8 | +Item { |
8 | 9 | id: root |
9 | 10 | property ShellScreen screen |
10 | 11 | property string widgetId: "" |
11 | 12 | property string section: "" |
12 | 13 | property int sectionWidgetIndex: -1 |
13 | 14 | property int sectionWidgetsCount: 0 |
14 | 15 | property var pluginApi: null |
15 | | - icon: "crosshair" |
16 | | - tooltipText: pluginApi?.tr("widget.tooltip") |
17 | | - tooltipDirection: BarService.getTooltipDirection(screen?.name) |
18 | | - colorBg: Style.capsuleColor |
19 | | - colorBorder: "transparent" |
20 | | - colorBorderHover: "transparent" |
21 | | - border.color: Style.capsuleBorderColor |
22 | | - border.width: Style.capsuleBorderWidth |
23 | | - onClicked: { |
24 | | - if (pluginApi) pluginApi.togglePanel(screen, this) |
| 16 | + |
| 17 | + implicitWidth: pill.width |
| 18 | + implicitHeight: pill.height |
| 19 | + |
| 20 | + BarPill { |
| 21 | + id: pill |
| 22 | + screen: root.screen |
| 23 | + oppositeDirection: BarService.getPillDirection(root) |
| 24 | + forceClose: true |
| 25 | + |
| 26 | + icon: "crosshair" |
| 27 | + tooltipText: pluginApi?.tr("widget.tooltip") |
| 28 | + |
| 29 | + onClicked: { |
| 30 | + if (pluginApi) pluginApi.togglePanel(root.screen, pill) |
| 31 | + } |
| 32 | + |
| 33 | + onRightClicked: { |
| 34 | + PanelService.showContextMenu(contextMenu, pill, root.screen) |
| 35 | + } |
| 36 | + } |
| 37 | + |
| 38 | + NPopupContextMenu { |
| 39 | + id: contextMenu |
| 40 | + model: [ |
| 41 | + { |
| 42 | + "label": pluginApi?.tr("settings.widgetSettings"), |
| 43 | + "action": "widget-settings", |
| 44 | + "icon": "settings", |
| 45 | + "enabled": true |
| 46 | + } |
| 47 | + ] |
| 48 | + onTriggered: action => { |
| 49 | + contextMenu.close() |
| 50 | + PanelService.closeContextMenu(root.screen) |
| 51 | + if (action === "widget-settings") |
| 52 | + BarService.openPluginSettings(screen, pluginApi.manifest) |
| 53 | + } |
25 | 54 | } |
26 | 55 | } |
0 commit comments