♻️ refactor(dock/components): delay visibility checks and initialization in dock components to prevent showing during startup
This commit is contained in:
3 files changed
+36
-12
No files matched your search
@@ -195,8 +195,8 @@ class RecordingIndicator(Button):
|
||||
|
||||
self.hide()
|
||||
|
||||
self.check_recording_status()
|
||||
self.timeout_id = GLib.timeout_add(1000, self.check_recording_status)
|
||||
# Delay initial check to prevent showing during dock initialization
|
||||
GLib.timeout_add(1000, self._delayed_init)
|
||||
|
||||
def check_recording_status(self):
|
||||
try:
|
||||
@@ -250,6 +250,15 @@ class RecordingIndicator(Button):
|
||||
except Exception as e:
|
||||
print(f"Error stopping recording: {e}")
|
||||
|
||||
def _delayed_init(self):
|
||||
"""Initialize recording status check after a delay to prevent showing during dock startup"""
|
||||
try:
|
||||
self.check_recording_status()
|
||||
self.timeout_id = GLib.timeout_add(1000, self.check_recording_status)
|
||||
except Exception as e:
|
||||
print(f"[DEBUG] Error in delayed recording indicator init: {e}")
|
||||
return False # Don't repeat this timeout
|
||||
|
||||
def cleanup(self):
|
||||
if hasattr(self, "timeout_id"):
|
||||
GLib.source_remove(self.timeout_id)
|
||||
|
||||
Reference in new issue
Block a user