diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-11 18:19:13 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-11 18:19:13 +0100 |
| commit | a0f2d4061267eeff391eab6467709361c47e55cd (patch) | |
| tree | 25f7d9419811494d10919f5b4da9f451ef17bc1d /tests/test_windows.py | |
| parent | e2c1f93088b945dae6f6ab0f66bd60842e9049dc (diff) | |
| download | deck-it-a0f2d4061267eeff391eab6467709361c47e55cd.tar.gz deck-it-a0f2d4061267eeff391eab6467709361c47e55cd.zip | |
fix(windows): skip special-workspace windows that have no id
Hyprland lists a window on a special workspace (e.g. special:dash) with
no workspace "id". _state indexed it directly, so one such window raised
KeyError on every poll and the Windows tab froze on its last list, with
stale previews and a stale active highlight.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_windows.py')
| -rw-r--r-- | tests/test_windows.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_windows.py b/tests/test_windows.py index 6950152..f05e546 100644 --- a/tests/test_windows.py +++ b/tests/test_windows.py @@ -93,6 +93,21 @@ class Commands(unittest.TestCase): st = windows._state(lambda cmd: responses[tuple(cmd)]) self.assertEqual(st["workspaces"], [1, 2, 5]) + def test_state_skips_a_special_workspace_without_id(self): + # Hyprland lists a special workspace with no "id"; one such window + # used to raise KeyError on every poll and freeze the tab. + special = {"address": "0x2", "class": "conky", "title": "c", "mapped": True, + "workspace": {"name": "special:dash"}} + normal = {"address": "0x1", "class": "kitty", "title": "t", "mapped": True, + "workspace": {"id": 1}} + responses = { + ("hyprctl", "clients", "-j"): json.dumps([special, normal]), + ("hyprctl", "activewindow", "-j"): "{}", + ("hyprctl", "workspaces", "-j"): '[{"id": 1}]', + } + st = windows._state(lambda cmd: responses[tuple(cmd)]) + self.assertEqual([w["address"] for w in st["windows"]], ["0x1"]) + def test_state_includes_empty_workspaces_and_launch_icons(self): responses = { ("hyprctl", "clients", "-j"): "[]", |
