ArchUpdater: fixed CPU hogging
This commit is contained in:
parent
7a849806fb
commit
b19fb316d9
3 changed files with 16 additions and 26 deletions
|
|
@ -13,19 +13,9 @@ NPanel {
|
||||||
panelHeight: 500 * scaling
|
panelHeight: 500 * scaling
|
||||||
panelAnchorRight: true
|
panelAnchorRight: true
|
||||||
|
|
||||||
// Auto-refresh when service updates
|
// When the panel opens
|
||||||
Connections {
|
onOpened: {
|
||||||
target: ArchUpdaterService
|
ArchUpdaterService.doPoll()
|
||||||
function onUpdatePackagesChanged() {
|
|
||||||
// Force UI update when packages change
|
|
||||||
if (root.visible) {
|
|
||||||
// Small delay to ensure data is fully updated
|
|
||||||
Qt.callLater(() => {
|
|
||||||
// Force a UI update by triggering a property change
|
|
||||||
ArchUpdaterService.updatePackages = ArchUpdaterService.updatePackages
|
|
||||||
}, 100)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
panelContent: Rectangle {
|
panelContent: Rectangle {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
/*pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
|
import qs.Commons
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: updateService
|
id: updateService
|
||||||
|
|
@ -15,20 +16,23 @@ Singleton {
|
||||||
property int selectedPackagesCount: 0
|
property int selectedPackagesCount: 0
|
||||||
property bool updateInProgress: false
|
property bool updateInProgress: false
|
||||||
|
|
||||||
|
// Initial check
|
||||||
|
Component.onCompleted: doPoll()
|
||||||
|
|
||||||
// Process for checking updates
|
// Process for checking updates
|
||||||
Process {
|
Process {
|
||||||
id: checkupdatesProcess
|
id: checkupdatesProcess
|
||||||
command: ["checkupdates"]
|
command: ["checkupdates"]
|
||||||
onExited: function (exitCode) {
|
onExited: function (exitCode) {
|
||||||
if (exitCode !== 0 && exitCode !== 2) {
|
if (exitCode !== 0 && exitCode !== 2) {
|
||||||
console.warn("[UpdateService] checkupdates failed (code:", exitCode, ")")
|
Logger.warn("ArchUpdater", "checkupdates failed (code:", exitCode, ")")
|
||||||
updatePackages = []
|
updatePackages = []
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
parseCheckupdatesOutput(text)
|
parseCheckupdatesOutput(text)
|
||||||
|
Logger.log("ArchUpdater", "found", updatePackages.length, "upgradable package(s)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -150,8 +154,4 @@ Singleton {
|
||||||
running: true
|
running: true
|
||||||
onTriggered: doPoll()
|
onTriggered: doPoll()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initial check
|
|
||||||
Component.onCompleted: doPoll()
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
@ -10,8 +10,8 @@ Singleton {
|
||||||
// Widget registry object mapping widget names to components
|
// Widget registry object mapping widget names to components
|
||||||
property var widgets: ({
|
property var widgets: ({
|
||||||
"ActiveWindow": activeWindowComponent,
|
"ActiveWindow": activeWindowComponent,
|
||||||
"Battery"// "ArchUpdater": archUpdaterComponent,
|
"ArchUpdater": archUpdaterComponent,
|
||||||
: batteryComponent,
|
"Battery": batteryComponent,
|
||||||
"Bluetooth": bluetoothComponent,
|
"Bluetooth": bluetoothComponent,
|
||||||
"Brightness": brightnessComponent,
|
"Brightness": brightnessComponent,
|
||||||
"Clock": clockComponent,
|
"Clock": clockComponent,
|
||||||
|
|
@ -32,9 +32,9 @@ Singleton {
|
||||||
property Component activeWindowComponent: Component {
|
property Component activeWindowComponent: Component {
|
||||||
ActiveWindow {}
|
ActiveWindow {}
|
||||||
}
|
}
|
||||||
// property Component archUpdaterComponent: Component {
|
property Component archUpdaterComponent: Component {
|
||||||
// ArchUpdater {}
|
ArchUpdater {}
|
||||||
// }
|
}
|
||||||
property Component batteryComponent: Component {
|
property Component batteryComponent: Component {
|
||||||
Battery {}
|
Battery {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue