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

refactor(SysUpdate): Explicit Run on Startup option in settings

- Relocated DMS System Updater to System Setting section
- Removed forced auto refresh upon update & widget loading
This commit is contained in:
purian23
2026-05-14 20:32:42 -04:00
parent e5cd9caba1
commit 0a892a4a9e
7 changed files with 55 additions and 26 deletions
+1
View File
@@ -720,6 +720,7 @@ Singleton {
property string customPowerActionPowerOff: ""
property bool updaterHideWidget: false
property bool updaterCheckOnStart: false
property bool updaterUseCustomCommand: false
property string updaterCustomCommand: ""
property string updaterTerminalAdditionalParams: ""
@@ -431,6 +431,7 @@ var SPEC = {
customPowerActionPowerOff: { def: "" },
updaterHideWidget: { def: false },
updaterCheckOnStart: { def: false },
updaterUseCustomCommand: { def: false },
updaterCustomCommand: { def: "" },
updaterTerminalAdditionalParams: { def: "" },
@@ -159,13 +159,6 @@ Rectangle {
"icon": "tune",
"tabIndex": 18
},
{
"id": "updater",
"text": I18n.tr("System Updater"),
"icon": "refresh",
"tabIndex": 20,
"updaterOnly": true
},
{
"id": "desktop_widgets",
"text": I18n.tr("Desktop Widgets"),
@@ -293,6 +286,13 @@ Rectangle {
"icon": "terminal",
"tabIndex": 32
},
{
"id": "updater",
"text": I18n.tr("System Updater"),
"icon": "refresh",
"tabIndex": 20,
"updaterOnly": true
},
{
"id": "window_rules",
"text": I18n.tr("Window Rules"),
@@ -75,16 +75,6 @@ DankPopout {
close();
}
onShouldBeVisibleChanged: {
if (!shouldBeVisible) {
return;
}
const stale = !SystemUpdateService.lastCheckUnix || (Date.now() / 1000 - SystemUpdateService.lastCheckUnix) > 300;
if (stale && !SystemUpdateService.isChecking && !SystemUpdateService.isUpgrading) {
SystemUpdateService.checkForUpdates();
}
}
content: Component {
Rectangle {
id: updaterPanel
@@ -93,6 +93,13 @@ Item {
}
}
SettingsToggleRow {
text: I18n.tr("Check on startup")
description: I18n.tr("When enabled, checks updates on startup. When disabled, only the interval above or a manual refresh runs a check.")
checked: SettingsData.updaterCheckOnStart
onToggled: checked => SettingsData.set("updaterCheckOnStart", checked)
}
SettingsToggleRow {
text: I18n.tr("Include Flatpak updates")
description: I18n.tr("Apply Flatpak updates alongside system updates when running 'Update All'.")
+38 -2
View File
@@ -43,22 +43,36 @@ Singleton {
root.checkCapabilities();
} else {
root.sysupdateAvailable = false;
root._startupCheckDone = false;
}
Qt.callLater(() => root._maybeStartupCheck());
}
function onSysupdateStateUpdate(data) {
root._applyState(data);
}
}
Connections {
target: SettingsData
function onUpdaterCheckOnStartChanged() {
Qt.callLater(() => root._maybeStartupCheck());
}
function on_HasLoadedChanged() {
Qt.callLater(() => root._maybeStartupCheck());
}
}
Component.onCompleted: {
if (DMSService.dmsAvailable) {
checkCapabilities();
}
Qt.callLater(() => root._maybeStartupCheck());
}
function checkCapabilities() {
if (!DMSService.capabilities || !Array.isArray(DMSService.capabilities)) {
sysupdateAvailable = false;
Qt.callLater(() => root._maybeStartupCheck());
return;
}
const has = DMSService.capabilities.includes("sysupdate");
@@ -68,6 +82,7 @@ Singleton {
} else if (!has) {
sysupdateAvailable = false;
}
Qt.callLater(() => root._maybeStartupCheck());
}
function requestState() {
@@ -171,10 +186,31 @@ Singleton {
Process {
id: customRunner
onExited: root.checkForUpdates()
}
onRefCountChanged: _syncAcquire()
property bool _startupCheckDone: false
function _maybeStartupCheck() {
if (refCount <= 0) {
_startupCheckDone = false;
return;
}
if (!SettingsData.updaterCheckOnStart)
return;
if (_startupCheckDone)
return;
if (!DMSService.isConnected || !sysupdateAvailable)
return;
_startupCheckDone = true;
Qt.callLater(() => root.checkForUpdates());
}
onRefCountChanged: {
if (refCount <= 0)
_startupCheckDone = false;
_syncAcquire();
Qt.callLater(() => root._maybeStartupCheck());
}
onSysupdateAvailableChanged: _syncAcquire()
property bool _acquired: false