From 6167f2283756276e2cb284b6fe0290ec3718eb8c Mon Sep 17 00:00:00 2001 From: purian23 Date: Fri, 8 May 2026 21:00:23 -0400 Subject: [PATCH] feat(SystemUpdate): Implement system update IPC commands --- docs/IPC.md | 16 ++++- quickshell/DMSShellIPC.qml | 33 ++++++++++ quickshell/Modules/DankBar/DankBarContent.qml | 62 ++++++++++--------- quickshell/Modules/DankBar/DankBarWindow.qml | 18 ++++++ quickshell/Services/PopoutService.qml | 6 +- quickshell/Services/SystemUpdateService.qml | 1 + 6 files changed, 104 insertions(+), 32 deletions(-) diff --git a/docs/IPC.md b/docs/IPC.md index 035dea93..77e1e574 100644 --- a/docs/IPC.md +++ b/docs/IPC.md @@ -409,16 +409,28 @@ dms ipc call bar status ## Target: `systemupdater` -System updater external check request. +System updater widget control and background update checks. ### Functions +**`toggle`** +- Toggle the system updater popout open/closed + +**`open`** +- Open the system updater popout + +**`close`** +- Close the system updater popout + **`updatestatus`** -- Trigger a system update check +- Trigger a background update check - Returns: Success confirmation ### Examples ```bash +dms ipc call systemupdater toggle +dms ipc call systemupdater open +dms ipc call systemupdater close dms ipc call systemupdater updatestatus ``` diff --git a/quickshell/DMSShellIPC.qml b/quickshell/DMSShellIPC.qml index 35620fc1..1d042d58 100644 --- a/quickshell/DMSShellIPC.qml +++ b/quickshell/DMSShellIPC.qml @@ -1160,6 +1160,39 @@ Item { target: "plugins" } + IpcHandler { + function toggle(): string { + if (PopoutService.systemUpdatePopout?.shouldBeVisible) { + PopoutService.systemUpdatePopout.close(); + return "SYSTEMUPDATER_TOGGLE_SUCCESS"; + } + const bar = root.getPreferredBar("systemUpdateButtonRef"); + if (bar) { + bar.triggerSystemUpdate(); + return "SYSTEMUPDATER_TOGGLE_SUCCESS"; + } + return "SYSTEMUPDATER_TOGGLE_FAILED"; + } + + function open(): string { + if (PopoutService.systemUpdatePopout?.shouldBeVisible) + return "SYSTEMUPDATER_ALREADY_OPEN"; + const bar = root.getPreferredBar("systemUpdateButtonRef"); + if (bar) { + bar.triggerSystemUpdate(); + return "SYSTEMUPDATER_OPEN_SUCCESS"; + } + return "SYSTEMUPDATER_OPEN_FAILED"; + } + + function close(): string { + PopoutService.closeSystemUpdate(); + return "SYSTEMUPDATER_CLOSE_SUCCESS"; + } + + target: "systemupdater" + } + IpcHandler { function open(): string { if (!PopoutService.clipboardHistoryModal) { diff --git a/quickshell/Modules/DankBar/DankBarContent.qml b/quickshell/Modules/DankBar/DankBarContent.qml index b0df7747..6a9a46a2 100644 --- a/quickshell/Modules/DankBar/DankBarContent.qml +++ b/quickshell/Modules/DankBar/DankBarContent.qml @@ -37,34 +37,34 @@ Item { property bool _hadAdjacentLeftBar: false property bool _hadAdjacentRightBar: false - onHasAdjacentTopBarLiveChanged: if (hasAdjacentTopBarLive) _hadAdjacentTopBar = true - onHasAdjacentBottomBarLiveChanged: if (hasAdjacentBottomBarLive) _hadAdjacentBottomBar = true - onHasAdjacentLeftBarLiveChanged: if (hasAdjacentLeftBarLive) _hadAdjacentLeftBar = true - onHasAdjacentRightBarLiveChanged: if (hasAdjacentRightBarLive) _hadAdjacentRightBar = true + onHasAdjacentTopBarLiveChanged: if (hasAdjacentTopBarLive) + _hadAdjacentTopBar = true + onHasAdjacentBottomBarLiveChanged: if (hasAdjacentBottomBarLive) + _hadAdjacentBottomBar = true + onHasAdjacentLeftBarLiveChanged: if (hasAdjacentLeftBarLive) + _hadAdjacentLeftBar = true + onHasAdjacentRightBarLiveChanged: if (hasAdjacentRightBarLive) + _hadAdjacentRightBar = true readonly property real _frameLeftInset: { - if (!_hasBarWindow || !SettingsData.frameEnabled || _barIsVertical) return 0 - return hasAdjacentLeftBarLive - ? SettingsData.frameBarSize - : (_hadAdjacentLeftBar ? _frameEdgeFloorInset : 0) + if (!_hasBarWindow || !SettingsData.frameEnabled || _barIsVertical) + return 0; + return hasAdjacentLeftBarLive ? SettingsData.frameBarSize : (_hadAdjacentLeftBar ? _frameEdgeFloorInset : 0); } readonly property real _frameRightInset: { - if (!_hasBarWindow || !SettingsData.frameEnabled || _barIsVertical) return 0 - return hasAdjacentRightBarLive - ? SettingsData.frameBarSize - : (_hadAdjacentRightBar ? _frameEdgeFloorInset : 0) + if (!_hasBarWindow || !SettingsData.frameEnabled || _barIsVertical) + return 0; + return hasAdjacentRightBarLive ? SettingsData.frameBarSize : (_hadAdjacentRightBar ? _frameEdgeFloorInset : 0); } readonly property real _frameTopInset: { - if (!_hasBarWindow || !SettingsData.frameEnabled || !_barIsVertical) return 0 - return hasAdjacentTopBarLive - ? SettingsData.frameThickness - : (_hadAdjacentTopBar ? _frameEdgeFloorInset : 0) + if (!_hasBarWindow || !SettingsData.frameEnabled || !_barIsVertical) + return 0; + return hasAdjacentTopBarLive ? SettingsData.frameThickness : (_hadAdjacentTopBar ? _frameEdgeFloorInset : 0); } readonly property real _frameBottomInset: { - if (!_hasBarWindow || !SettingsData.frameEnabled || !_barIsVertical) return 0 - return hasAdjacentBottomBarLive - ? SettingsData.frameThickness - : (_hadAdjacentBottomBar ? _frameEdgeFloorInset : 0) + if (!_hasBarWindow || !SettingsData.frameEnabled || !_barIsVertical) + return 0; + return hasAdjacentBottomBarLive ? SettingsData.frameThickness : (_hadAdjacentBottomBar ? _frameEdgeFloorInset : 0); } property alias hLeftSection: hLeftSection @@ -75,14 +75,10 @@ Item { property alias vRightSection: vRightSection anchors.fill: parent - anchors.leftMargin: _edgeBaseMargin + _frameLeftInset - anchors.rightMargin: _edgeBaseMargin + _frameRightInset - anchors.topMargin: (_barIsVertical - ? (hasAdjacentTopBarLive ? outlineThickness : Theme.spacingXS) - : 0) + _frameTopInset - anchors.bottomMargin: (_barIsVertical - ? (hasAdjacentBottomBarLive ? outlineThickness : Theme.spacingXS) - : 0) + _frameBottomInset + anchors.leftMargin: _edgeBaseMargin + _frameLeftInset + anchors.rightMargin: _edgeBaseMargin + _frameRightInset + anchors.topMargin: (_barIsVertical ? (hasAdjacentTopBarLive ? outlineThickness : Theme.spacingXS) : 0) + _frameTopInset + anchors.bottomMargin: (_barIsVertical ? (hasAdjacentBottomBarLive ? outlineThickness : Theme.spacingXS) : 0) + _frameBottomInset clip: false DeferredAction { @@ -1535,6 +1531,16 @@ Item { section: topBarContent.getWidgetSection(parent) || "right" popoutTarget: systemUpdateLoader.item ?? null parentScreen: barWindow.screen + + Component.onCompleted: { + barWindow.systemUpdateButtonRef = this; + } + + Component.onDestruction: { + if (barWindow.systemUpdateButtonRef === this) + barWindow.systemUpdateButtonRef = null; + } + onClicked: { systemUpdateLoader.active = true; if (!systemUpdateLoader.item) diff --git a/quickshell/Modules/DankBar/DankBarWindow.qml b/quickshell/Modules/DankBar/DankBarWindow.qml index 222ad98e..ab4599d4 100644 --- a/quickshell/Modules/DankBar/DankBarWindow.qml +++ b/quickshell/Modules/DankBar/DankBarWindow.qml @@ -20,6 +20,24 @@ PanelWindow { property var controlCenterButtonRef: null property var clockButtonRef: null + property var systemUpdateButtonRef: null + + function triggerSystemUpdate() { + systemUpdateLoader.active = true; + if (!systemUpdateLoader.item) + return; + const popout = systemUpdateLoader.item; + const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1)); + if (systemUpdateButtonRef && popout.setTriggerPosition) { + const screenPos = systemUpdateButtonRef.mapToItem(null, 0, 0); + const pos = SettingsData.getPopupTriggerPosition(screenPos, barWindow.screen, barWindow.effectiveBarThickness, systemUpdateButtonRef.width, barConfig?.spacing ?? 4, barPosition, barConfig); + const section = systemUpdateButtonRef.section || "right"; + popout.setTriggerPosition(pos.x, pos.y, pos.width, section, barWindow.screen, barPosition, barWindow.effectiveBarThickness, barConfig?.spacing ?? 4, barConfig); + } else { + popout.screen = barWindow.screen; + } + PopoutManager.requestPopout(popout, undefined, "systemUpdate"); + } function triggerControlCenter() { controlCenterLoader.active = true; diff --git a/quickshell/Services/PopoutService.qml b/quickshell/Services/PopoutService.qml index 1f152e70..eb51cc9f 100644 --- a/quickshell/Services/PopoutService.qml +++ b/quickshell/Services/PopoutService.qml @@ -304,7 +304,8 @@ Singleton { function openSystemUpdate(x, y, width, section, screen) { if (systemUpdatePopout) { - setPosition(systemUpdatePopout, x, y, width, section, screen); + if (arguments.length >= 5) + setPosition(systemUpdatePopout, x, y, width, section, screen); systemUpdatePopout.open(); } } @@ -322,7 +323,8 @@ Singleton { function toggleSystemUpdate(x, y, width, section, screen) { if (systemUpdatePopout) { - setPosition(systemUpdatePopout, x, y, width, section, screen); + if (arguments.length >= 5) + setPosition(systemUpdatePopout, x, y, width, section, screen); systemUpdatePopout.toggle(); } } diff --git a/quickshell/Services/SystemUpdateService.qml b/quickshell/Services/SystemUpdateService.qml index 85710ce8..905b92f6 100644 --- a/quickshell/Services/SystemUpdateService.qml +++ b/quickshell/Services/SystemUpdateService.qml @@ -5,6 +5,7 @@ import QtQuick import Quickshell import Quickshell.Io import qs.Common +import qs.Services Singleton { id: root