mirror of
https://github.com/Omni-guides/Jackify.git
synced 2026-06-08 02:37:44 +02:00
Sync from development - prepare for v0.5.0.4
This commit is contained in:
@@ -15,44 +15,19 @@ class FocusReclaimMixin:
|
||||
progress messages for STEAM_RESTART_SENTINEL.
|
||||
"""
|
||||
|
||||
def _start_focus_reclaim_retries(self):
|
||||
try:
|
||||
if hasattr(self, "_focus_reclaim_timer") and self._focus_reclaim_timer:
|
||||
self._focus_reclaim_timer.stop()
|
||||
self._focus_reclaim_timer.deleteLater()
|
||||
except Exception:
|
||||
pass
|
||||
def _stop_focus_reclaim(self):
|
||||
pass # No timer to stop — single-shot, no state
|
||||
|
||||
self._focus_reclaim_attempt = 0
|
||||
self._focus_reclaim_max_attempts = 12 # ~24 seconds total
|
||||
self._focus_reclaim_timer = QTimer(self)
|
||||
self._focus_reclaim_timer.setInterval(2000)
|
||||
self._focus_reclaim_timer.timeout.connect(self._focus_reclaim_tick)
|
||||
self._focus_reclaim_timer.start()
|
||||
self._focus_reclaim_tick()
|
||||
def _start_focus_reclaim_retries(self):
|
||||
QTimer.singleShot(500, self._focus_reclaim_tick)
|
||||
|
||||
def _focus_reclaim_tick(self):
|
||||
try:
|
||||
win = self.window()
|
||||
if win is None:
|
||||
return
|
||||
|
||||
self._focus_reclaim_attempt += 1
|
||||
win.raise_()
|
||||
win.activateWindow()
|
||||
win.setWindowState(win.windowState() & ~Qt.WindowMinimized | Qt.WindowActive)
|
||||
|
||||
if win.isActiveWindow():
|
||||
logger.info("Foreground focus reclaimed after Steam restart")
|
||||
self._focus_reclaim_timer.stop()
|
||||
return
|
||||
|
||||
if self._focus_reclaim_attempt >= self._focus_reclaim_max_attempts:
|
||||
logger.warning("Foreground focus reclaim timed out after Steam restart")
|
||||
self._focus_reclaim_timer.stop()
|
||||
except Exception as e:
|
||||
logger.debug(f"Focus reclaim tick failed: {e}")
|
||||
try:
|
||||
self._focus_reclaim_timer.stop()
|
||||
except Exception:
|
||||
pass
|
||||
logger.debug(f"Focus reclaim attempt failed: {e}")
|
||||
|
||||
Reference in New Issue
Block a user