From 2a4c2b68679f5258d83565dc6c92c17fc0491445 Mon Sep 17 00:00:00 2001 From: Ali Mirjamali Date: Wed, 13 Nov 2024 16:29:37 +0330 Subject: [PATCH] Refresh disk usage stats every 60s if focused resolves: https://github.com/QubesOS/qubes-issues/issues/7619 --- qubesmanager/qube_manager.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index a38187fd..564f85cf 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -876,6 +876,8 @@ def __init__(self, qt_app, qubes_app, dispatcher, _parent=None): dispatcher.add_handler('domain-feature-delete:updates-available', self.on_domain_updates_available) + self.installEventFilter(self) + # It needs to store threads until they finish self.threads_list = [] self.progress = None @@ -886,6 +888,15 @@ def __init__(self, qt_app, qubes_app, dispatcher, _parent=None): self.size_on_disk_timer.setInterval(1000 * 60 * 5) # every 5 mins self.size_on_disk_timer.start() + def eventFilter(self, _object, event): + ''' refresh disk usage every 60s if focused & every 5m in background ''' + if event.type() == QEvent.Type.WindowActivate: + self.update_running_size() + self.size_on_disk_timer.setInterval(1000 * 60) + elif event.type() == QEvent.Type.WindowDeactivate: + self.size_on_disk_timer.setInterval(1000 * 60 * 5) + return False + def scroll_to_top(self): self.table.selectRow(0) self.table.scrollToTop()