1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-08 21:42:05 -04:00

feat(SystemUpdate): Implement system update IPC commands

This commit is contained in:
purian23
2026-05-08 21:00:23 -04:00
parent d8835f2bc6
commit 6167f22837
6 changed files with 104 additions and 32 deletions

View File

@@ -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
```

View File

@@ -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) {

View File

@@ -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)

View File

@@ -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;

View File

@@ -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();
}
}

View File

@@ -5,6 +5,7 @@ import QtQuick
import Quickshell
import Quickshell.Io
import qs.Common
import qs.Services
Singleton {
id: root