This commit is contained in:
2026-04-06 08:31:38 -05:00
parent aff58a1214
commit 5a84a8f294
41 changed files with 1211 additions and 104 deletions

View File

@@ -13,6 +13,8 @@ Item {
property ShellScreen screen
property string widgetId: ""
property string section: ""
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
property bool hovered: false
// Bar positioning properties
@@ -82,13 +84,9 @@ Item {
MouseArea {
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
cursorShape: root.pluginApi?.mainInstance?.updateCount > 0 ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: {
if (root.pluginApi?.mainInstance?.updateCount > 0)
root.pluginApi?.mainInstance?.startDoSystemUpdate();
}
onEntered: {
root.hovered = true;
buildTooltip();
@@ -98,15 +96,53 @@ Item {
root.hovered = false;
TooltipService.hide();
}
onPressed: mouse => {
TooltipService.hide();
if (mouse.button == Qt.LeftButton && root.pluginApi?.mainInstance?.updateCount > 0)
root.pluginApi?.mainInstance?.startDoSystemUpdate();
else if (mouse.button == Qt.RightButton)
PanelService.showContextMenu(contextMenu, root, screen);
}
NPopupContextMenu {
id: contextMenu
model: [
{
"label": "Update",
"action": "run-update-cmd",
"icon": "arrow-up-from-arc",
"enabled": root.pluginApi?.mainInstance?.updateCount > 0
},
{
"label": I18n.tr("actions.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
contextMenu.close();
PanelService.closeContextMenu(screen);
if (action === "run-update-cmd")
root.pluginApi?.mainInstance?.startDoSystemUpdate();
else if (action === "widget-settings") {
BarService.openPluginSettings(screen, pluginApi.manifest);
}
}
}
}
function buildTooltip() {
const updateCount = root.pluginApi?.mainInstance?.updateCount
if (updateCount === 0) {
TooltipService.show(root, pluginApi?.tr("tooltip.noUpdatesAvailable"), BarService.getTooltipDirection());
TooltipService.show(root, pluginApi?.tr("tooltip.noUpdatesAvailable"), BarService.getTooltipDirection(root.screenName));
} else {
TooltipService.show(root, pluginApi?.tr("tooltip.updatesAvailable"), BarService.getTooltipDirection());
TooltipService.show(root, pluginApi?.tr("tooltip.updatesAvailable"), BarService.getTooltipDirection(root.screenName));
}
}
}

View File

@@ -1,13 +1,16 @@
{
"id": "update-count",
"name": "Update Count",
"version": "1.0.12",
"version": "1.0.14",
"minNoctaliaVersion": "3.6.0",
"author": "BukoMoon",
"license": "GPLv3",
"repository": "https://github.com/noctalia-dev/noctalia-plugins",
"description": "Checks for system updates and shows the update count. Click to run update command in a terminal.",
"tags": ["Bar", "System"],
"tags": [
"Bar",
"System"
],
"entryPoints": {
"main": "Main.qml",
"barWidget": "BarWidget.qml",