diff options
Diffstat (limited to 'noctalia/.config/plugins/keybind-cheatsheet/BarWidget.qml')
| -rw-r--r-- | noctalia/.config/plugins/keybind-cheatsheet/BarWidget.qml | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/noctalia/.config/plugins/keybind-cheatsheet/BarWidget.qml b/noctalia/.config/plugins/keybind-cheatsheet/BarWidget.qml new file mode 100644 index 0000000..349d9cc --- /dev/null +++ b/noctalia/.config/plugins/keybind-cheatsheet/BarWidget.qml @@ -0,0 +1,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); + } +} |
