diff options
| -rw-r--r-- | deckit/modules/windows.py | 2 | ||||
| -rw-r--r-- | tests/test_windows.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/deckit/modules/windows.py b/deckit/modules/windows.py index 69b1210..67dbbd2 100644 --- a/deckit/modules/windows.py +++ b/deckit/modules/windows.py @@ -83,7 +83,7 @@ def workspace_cmd(n: int, lua: bool): def window_cmd(verb: str, addr: str, lua: bool): if lua: dsp = "hl.dsp.focus" if verb == "focus" else "hl.dsp.window.close" - return ["hyprctl", "eval", f'{dsp}({{window = "address:{addr}"}})'] + return ["hyprctl", "eval", f'hl.dispatch({dsp}({{window = "address:{addr}"}}))'] return ["hyprctl", "dispatch", "focuswindow" if verb == "focus" else "closewindow", f"address:{addr}"] diff --git a/tests/test_windows.py b/tests/test_windows.py index 8e27d26..f8e4c3d 100644 --- a/tests/test_windows.py +++ b/tests/test_windows.py @@ -44,6 +44,12 @@ class Commands(unittest.TestCase): ["hyprctl", "dispatch", "workspace", "3"]) self.assertEqual(windows.workspace_cmd(3, lua=True)[:2], ["hyprctl", "eval"]) + def test_window_commands_are_dispatched(self): + self.assertEqual(windows.window_cmd("focus", "0x1", lua=True), + ["hyprctl", "eval", 'hl.dispatch(hl.dsp.focus({window = "address:0x1"}))']) + self.assertEqual(windows.window_cmd("close", "0x1", lua=True), + ["hyprctl", "eval", 'hl.dispatch(hl.dsp.window.close({window = "address:0x1"}))']) + def test_address_guard(self): self.assertIsNone(windows.ADDR.fullmatch("0x1;rm")) self.assertTrue(windows.ADDR.fullmatch("0x55897e5c0800")) |
