noctalia
This commit is contained in:
@@ -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
|
||||
|
||||
icon: "clipboard-data"
|
||||
tooltipText: pluginApi?.tr("bar.tooltip")
|
||||
tooltipDirection: BarService.getTooltipDirection(screen?.name)
|
||||
baseSize: Style.getCapsuleHeightForScreen(screen?.name)
|
||||
applyUiScale: false
|
||||
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("context.toggle"),
|
||||
"action": "toggle-clipper",
|
||||
"icon": "clipboard"
|
||||
},
|
||||
{
|
||||
"label": pluginApi?.tr("context.settings"),
|
||||
"action": "open-settings",
|
||||
"icon": "settings"
|
||||
},
|
||||
]
|
||||
|
||||
onTriggered: action => {
|
||||
contextMenu.close();
|
||||
PanelService.closeContextMenu(screen);
|
||||
|
||||
if (action === "toggle-clipper") {
|
||||
if (pluginApi?.togglePanel) {
|
||||
pluginApi.togglePanel(screen);
|
||||
}
|
||||
} else if (action === "open-settings") {
|
||||
if (pluginApi?.manifest) {
|
||||
BarService.openPluginSettings(screen, pluginApi.manifest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if (pluginApi?.openPanel) {
|
||||
pluginApi.openPanel(screen, this);
|
||||
}
|
||||
}
|
||||
|
||||
onRightClicked: {
|
||||
PanelService.showContextMenu(contextMenu, root, screen);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user