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
|
||||
panelAnchorRight: true
|
||||
|
||||
// Auto-refresh when service updates
|
||||
Connections {
|
||||
target: ArchUpdaterService
|
||||
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)
|
||||
}
|
||||
}
|
||||
// When the panel opens
|
||||
onOpened: {
|
||||
ArchUpdaterService.doPoll()
|
||||
}
|
||||
|
||||
panelContent: Rectangle {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
/*pragma Singleton
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Commons
|
||||
|
||||
Singleton {
|
||||
id: updateService
|
||||
|
|
@ -15,20 +16,23 @@ Singleton {
|
|||
property int selectedPackagesCount: 0
|
||||
property bool updateInProgress: false
|
||||
|
||||
// Initial check
|
||||
Component.onCompleted: doPoll()
|
||||
|
||||
// Process for checking updates
|
||||
Process {
|
||||
id: checkupdatesProcess
|
||||
command: ["checkupdates"]
|
||||
onExited: function (exitCode) {
|
||||
if (exitCode !== 0 && exitCode !== 2) {
|
||||
console.warn("[UpdateService] checkupdates failed (code:", exitCode, ")")
|
||||
Logger.warn("ArchUpdater", "checkupdates failed (code:", exitCode, ")")
|
||||
updatePackages = []
|
||||
return
|
||||
}
|
||||
}
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
parseCheckupdatesOutput(text)
|
||||
Logger.log("ArchUpdater", "found", updatePackages.length, "upgradable package(s)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -150,8 +154,4 @@ Singleton {
|
|||
running: true
|
||||
onTriggered: doPoll()
|
||||
}
|
||||
|
||||
// Initial check
|
||||
Component.onCompleted: doPoll()
|
||||
}
|
||||
*/
|
||||
|
|
@ -10,8 +10,8 @@ Singleton {
|
|||
// Widget registry object mapping widget names to components
|
||||
property var widgets: ({
|
||||
"ActiveWindow": activeWindowComponent,
|
||||
"Battery"// "ArchUpdater": archUpdaterComponent,
|
||||
: batteryComponent,
|
||||
"ArchUpdater": archUpdaterComponent,
|
||||
"Battery": batteryComponent,
|
||||
"Bluetooth": bluetoothComponent,
|
||||
"Brightness": brightnessComponent,
|
||||
"Clock": clockComponent,
|
||||
|
|
@ -32,9 +32,9 @@ Singleton {
|
|||
property Component activeWindowComponent: Component {
|
||||
ActiveWindow {}
|
||||
}
|
||||
// property Component archUpdaterComponent: Component {
|
||||
// ArchUpdater {}
|
||||
// }
|
||||
property Component archUpdaterComponent: Component {
|
||||
ArchUpdater {}
|
||||
}
|
||||
property Component batteryComponent: Component {
|
||||
Battery {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue