From 0033fbce9b76e7268bb1fc25dffdd88758ad080b Mon Sep 17 00:00:00 2001 From: max Date: Tue, 8 Sep 2026 23:46:30 +0200 Subject: [PATCH] feat(window_manager): add get_display_topology_signature for dynamic monitor and resolution change detection --- catser/window_manager.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/catser/window_manager.py b/catser/window_manager.py index deb7a0e..5253686 100644 --- a/catser/window_manager.py +++ b/catser/window_manager.py @@ -349,6 +349,16 @@ class WindowManager: user32.EnumDisplayMonitors(0, None, MONITORENUMPROC(enum_mon_proc), 0) return monitors + @classmethod + def get_display_topology_signature(cls) -> tuple: + """ + Returns a hashable signature representing current displays, resolutions, and work areas. + Used to detect dynamic monitor connection, disconnection, or resolution adjustments. + """ + monitors = cls.get_monitors() + vd = cls.get_virtual_desktop_bounds() + return (vd, tuple((m.handle, m.is_primary, m.rect, m.work_area) for m in monitors)) + @classmethod def get_floor_y_at(cls, x: float, cat_height: int) -> float: """