aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_windows.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-09 20:41:29 +0100
committerDanilo M. <danix@danix.xyz>2026-11-09 20:41:29 +0100
commit6465ffceeef5c3df404972bf4eaa1b24e451a7c4 (patch)
tree4b1c769fb39809a9b2ca7570190baed3ecc1bde0 /tests/test_windows.py
parent853f1ed1928aaeca9ea956c24bee12cd56a7cfdd (diff)
downloaddeck-it-6465ffceeef5c3df404972bf4eaa1b24e451a7c4.tar.gz
deck-it-6465ffceeef5c3df404972bf4eaa1b24e451a7c4.zip
feat: window rows get app icons and a close/move menu
Diffstat (limited to 'tests/test_windows.py')
-rw-r--r--tests/test_windows.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_windows.py b/tests/test_windows.py
index ca9be71..8e27d26 100644
--- a/tests/test_windows.py
+++ b/tests/test_windows.py
@@ -4,10 +4,40 @@ from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
import unittest
+from unittest import mock
import deckit.modules.windows as windows
+class DesktopIcons(unittest.TestCase):
+ def test_maps_class_and_wmclass(self):
+ import tempfile
+ from pathlib import Path
+ base = Path(tempfile.mkdtemp())
+ (base / "com.obsproject.Studio.desktop").write_text(
+ "[Desktop Entry]\nIcon=com.obsproject.Studio\nStartupWMClass=obs\n")
+ mapping = windows._desktop_icons([base])
+ self.assertEqual(mapping["com.obsproject.studio"], ["com.obsproject.Studio", "obs"])
+ self.assertEqual(mapping["obs"], ["com.obsproject.Studio", "obs"])
+
+
+class Move(unittest.TestCase):
+ def test_lua_focuses_then_moves(self):
+ calls = []
+ m = windows.make({"hyprland": "lua", "run": lambda cmd: "[]"})
+ with mock.patch.object(windows, "_dispatch", lambda cmd: calls.append(cmd)):
+ m.actions["move"]({"address": "0x1", "n": 3})
+ self.assertIn("focus", calls[0][2])
+ self.assertIn("window.move", calls[1][2])
+
+ def test_classic_uses_movetoworkspacesilent(self):
+ calls = []
+ m = windows.make({"hyprland": "classic", "run": lambda cmd: "[]"})
+ with mock.patch.object(windows, "_dispatch", lambda cmd: calls.append(cmd)):
+ m.actions["move"]({"address": "0x1", "n": 3})
+ self.assertEqual(calls[0], ["hyprctl", "dispatch", "movetoworkspacesilent", "3,address:0x1"])
+
+
class Commands(unittest.TestCase):
def test_lua_and_classic(self):
self.assertEqual(windows.workspace_cmd(3, lua=False),