mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-15 00:32:47 -04:00
feat(SystemUpdate): Implement system update IPC commands
This commit is contained in:
+14
-2
@@ -409,16 +409,28 @@ dms ipc call bar status
|
|||||||
|
|
||||||
## Target: `systemupdater`
|
## Target: `systemupdater`
|
||||||
|
|
||||||
System updater external check request.
|
System updater widget control and background update checks.
|
||||||
|
|
||||||
### Functions
|
### Functions
|
||||||
|
|
||||||
|
**`toggle`**
|
||||||
|
- Toggle the system updater popout open/closed
|
||||||
|
|
||||||
|
**`open`**
|
||||||
|
- Open the system updater popout
|
||||||
|
|
||||||
|
**`close`**
|
||||||
|
- Close the system updater popout
|
||||||
|
|
||||||
**`updatestatus`**
|
**`updatestatus`**
|
||||||
- Trigger a system update check
|
- Trigger a background update check
|
||||||
- Returns: Success confirmation
|
- Returns: Success confirmation
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
```bash
|
```bash
|
||||||
|
dms ipc call systemupdater toggle
|
||||||
|
dms ipc call systemupdater open
|
||||||
|
dms ipc call systemupdater close
|
||||||
dms ipc call systemupdater updatestatus
|
dms ipc call systemupdater updatestatus
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1160,6 +1160,39 @@ Item {
|
|||||||
target: "plugins"
|
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 {
|
IpcHandler {
|
||||||
function open(): string {
|
function open(): string {
|
||||||
if (!PopoutService.clipboardHistoryModal) {
|
if (!PopoutService.clipboardHistoryModal) {
|
||||||
|
|||||||
@@ -37,34 +37,34 @@ Item {
|
|||||||
property bool _hadAdjacentLeftBar: false
|
property bool _hadAdjacentLeftBar: false
|
||||||
property bool _hadAdjacentRightBar: false
|
property bool _hadAdjacentRightBar: false
|
||||||
|
|
||||||
onHasAdjacentTopBarLiveChanged: if (hasAdjacentTopBarLive) _hadAdjacentTopBar = true
|
onHasAdjacentTopBarLiveChanged: if (hasAdjacentTopBarLive)
|
||||||
onHasAdjacentBottomBarLiveChanged: if (hasAdjacentBottomBarLive) _hadAdjacentBottomBar = true
|
_hadAdjacentTopBar = true
|
||||||
onHasAdjacentLeftBarLiveChanged: if (hasAdjacentLeftBarLive) _hadAdjacentLeftBar = true
|
onHasAdjacentBottomBarLiveChanged: if (hasAdjacentBottomBarLive)
|
||||||
onHasAdjacentRightBarLiveChanged: if (hasAdjacentRightBarLive) _hadAdjacentRightBar = true
|
_hadAdjacentBottomBar = true
|
||||||
|
onHasAdjacentLeftBarLiveChanged: if (hasAdjacentLeftBarLive)
|
||||||
|
_hadAdjacentLeftBar = true
|
||||||
|
onHasAdjacentRightBarLiveChanged: if (hasAdjacentRightBarLive)
|
||||||
|
_hadAdjacentRightBar = true
|
||||||
|
|
||||||
readonly property real _frameLeftInset: {
|
readonly property real _frameLeftInset: {
|
||||||
if (!_hasBarWindow || !SettingsData.frameEnabled || _barIsVertical) return 0
|
if (!_hasBarWindow || !SettingsData.frameEnabled || _barIsVertical)
|
||||||
return hasAdjacentLeftBarLive
|
return 0;
|
||||||
? SettingsData.frameBarSize
|
return hasAdjacentLeftBarLive ? SettingsData.frameBarSize : (_hadAdjacentLeftBar ? _frameEdgeFloorInset : 0);
|
||||||
: (_hadAdjacentLeftBar ? _frameEdgeFloorInset : 0)
|
|
||||||
}
|
}
|
||||||
readonly property real _frameRightInset: {
|
readonly property real _frameRightInset: {
|
||||||
if (!_hasBarWindow || !SettingsData.frameEnabled || _barIsVertical) return 0
|
if (!_hasBarWindow || !SettingsData.frameEnabled || _barIsVertical)
|
||||||
return hasAdjacentRightBarLive
|
return 0;
|
||||||
? SettingsData.frameBarSize
|
return hasAdjacentRightBarLive ? SettingsData.frameBarSize : (_hadAdjacentRightBar ? _frameEdgeFloorInset : 0);
|
||||||
: (_hadAdjacentRightBar ? _frameEdgeFloorInset : 0)
|
|
||||||
}
|
}
|
||||||
readonly property real _frameTopInset: {
|
readonly property real _frameTopInset: {
|
||||||
if (!_hasBarWindow || !SettingsData.frameEnabled || !_barIsVertical) return 0
|
if (!_hasBarWindow || !SettingsData.frameEnabled || !_barIsVertical)
|
||||||
return hasAdjacentTopBarLive
|
return 0;
|
||||||
? SettingsData.frameThickness
|
return hasAdjacentTopBarLive ? SettingsData.frameThickness : (_hadAdjacentTopBar ? _frameEdgeFloorInset : 0);
|
||||||
: (_hadAdjacentTopBar ? _frameEdgeFloorInset : 0)
|
|
||||||
}
|
}
|
||||||
readonly property real _frameBottomInset: {
|
readonly property real _frameBottomInset: {
|
||||||
if (!_hasBarWindow || !SettingsData.frameEnabled || !_barIsVertical) return 0
|
if (!_hasBarWindow || !SettingsData.frameEnabled || !_barIsVertical)
|
||||||
return hasAdjacentBottomBarLive
|
return 0;
|
||||||
? SettingsData.frameThickness
|
return hasAdjacentBottomBarLive ? SettingsData.frameThickness : (_hadAdjacentBottomBar ? _frameEdgeFloorInset : 0);
|
||||||
: (_hadAdjacentBottomBar ? _frameEdgeFloorInset : 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
property alias hLeftSection: hLeftSection
|
property alias hLeftSection: hLeftSection
|
||||||
@@ -75,14 +75,10 @@ Item {
|
|||||||
property alias vRightSection: vRightSection
|
property alias vRightSection: vRightSection
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: _edgeBaseMargin + _frameLeftInset
|
anchors.leftMargin: _edgeBaseMargin + _frameLeftInset
|
||||||
anchors.rightMargin: _edgeBaseMargin + _frameRightInset
|
anchors.rightMargin: _edgeBaseMargin + _frameRightInset
|
||||||
anchors.topMargin: (_barIsVertical
|
anchors.topMargin: (_barIsVertical ? (hasAdjacentTopBarLive ? outlineThickness : Theme.spacingXS) : 0) + _frameTopInset
|
||||||
? (hasAdjacentTopBarLive ? outlineThickness : Theme.spacingXS)
|
anchors.bottomMargin: (_barIsVertical ? (hasAdjacentBottomBarLive ? outlineThickness : Theme.spacingXS) : 0) + _frameBottomInset
|
||||||
: 0) + _frameTopInset
|
|
||||||
anchors.bottomMargin: (_barIsVertical
|
|
||||||
? (hasAdjacentBottomBarLive ? outlineThickness : Theme.spacingXS)
|
|
||||||
: 0) + _frameBottomInset
|
|
||||||
clip: false
|
clip: false
|
||||||
|
|
||||||
DeferredAction {
|
DeferredAction {
|
||||||
@@ -1535,6 +1531,16 @@ Item {
|
|||||||
section: topBarContent.getWidgetSection(parent) || "right"
|
section: topBarContent.getWidgetSection(parent) || "right"
|
||||||
popoutTarget: systemUpdateLoader.item ?? null
|
popoutTarget: systemUpdateLoader.item ?? null
|
||||||
parentScreen: barWindow.screen
|
parentScreen: barWindow.screen
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
barWindow.systemUpdateButtonRef = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onDestruction: {
|
||||||
|
if (barWindow.systemUpdateButtonRef === this)
|
||||||
|
barWindow.systemUpdateButtonRef = null;
|
||||||
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
systemUpdateLoader.active = true;
|
systemUpdateLoader.active = true;
|
||||||
if (!systemUpdateLoader.item)
|
if (!systemUpdateLoader.item)
|
||||||
|
|||||||
@@ -20,6 +20,24 @@ PanelWindow {
|
|||||||
|
|
||||||
property var controlCenterButtonRef: null
|
property var controlCenterButtonRef: null
|
||||||
property var clockButtonRef: 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() {
|
function triggerControlCenter() {
|
||||||
controlCenterLoader.active = true;
|
controlCenterLoader.active = true;
|
||||||
|
|||||||
@@ -304,7 +304,8 @@ Singleton {
|
|||||||
|
|
||||||
function openSystemUpdate(x, y, width, section, screen) {
|
function openSystemUpdate(x, y, width, section, screen) {
|
||||||
if (systemUpdatePopout) {
|
if (systemUpdatePopout) {
|
||||||
setPosition(systemUpdatePopout, x, y, width, section, screen);
|
if (arguments.length >= 5)
|
||||||
|
setPosition(systemUpdatePopout, x, y, width, section, screen);
|
||||||
systemUpdatePopout.open();
|
systemUpdatePopout.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -322,7 +323,8 @@ Singleton {
|
|||||||
|
|
||||||
function toggleSystemUpdate(x, y, width, section, screen) {
|
function toggleSystemUpdate(x, y, width, section, screen) {
|
||||||
if (systemUpdatePopout) {
|
if (systemUpdatePopout) {
|
||||||
setPosition(systemUpdatePopout, x, y, width, section, screen);
|
if (arguments.length >= 5)
|
||||||
|
setPosition(systemUpdatePopout, x, y, width, section, screen);
|
||||||
systemUpdatePopout.toggle();
|
systemUpdatePopout.toggle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import QtQuick
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import qs.Common
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|||||||
Reference in New Issue
Block a user