summaryrefslogtreecommitdiff
path: root/noctalia/.config/plugins/keybind-cheatsheet/BarWidget.qml
diff options
context:
space:
mode:
authorseraphim <18ycm9tx@anonaddy.me>2026-07-24 20:57:33 +0700
committerseraphim <18ycm9tx@anonaddy.me>2026-07-24 20:57:33 +0700
commit395c08d0a334cdffbcc370384bee67f19f964399 (patch)
treed57cdf13385785aaf068d4f8408fe6cc2f095999 /noctalia/.config/plugins/keybind-cheatsheet/BarWidget.qml
frst
Diffstat (limited to 'noctalia/.config/plugins/keybind-cheatsheet/BarWidget.qml')
-rw-r--r--noctalia/.config/plugins/keybind-cheatsheet/BarWidget.qml75
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);
+ }
+}