diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-04-26 15:16:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-26 15:16:36 +0100 |
| commit | 5ba33f846129f3e6c0505b19f94634b24505e828 (patch) | |
| tree | aaacabe678006040c342935481a86607c66607fd /hyprtester/src/tests/main/workspaces.cpp | |
| parent | 329b2b356dd92ac07f4e2aa69cbce82ee9ba9d19 (diff) | |
config/lua: init lua config manager, use lua if available (#13817)
Adds a new lua config manager, which will automatically be used if there is a lua config present.
Diffstat (limited to 'hyprtester/src/tests/main/workspaces.cpp')
| -rw-r--r-- | hyprtester/src/tests/main/workspaces.cpp | 262 |
1 files changed, 131 insertions, 131 deletions
diff --git a/hyprtester/src/tests/main/workspaces.cpp b/hyprtester/src/tests/main/workspaces.cpp index f7c948f2..2975b568 100644 --- a/hyprtester/src/tests/main/workspaces.cpp +++ b/hyprtester/src/tests/main/workspaces.cpp @@ -28,17 +28,17 @@ static bool testSpecialWorkspaceFullscreen() { // Close special workspace if open auto monitors = getFromSocket("/monitors"); if (monitors.contains("(special:test_fs_special)") && !monitors.contains("special workspace: 0 ()")) - getFromSocket("/dispatch togglespecialworkspace test_fs_special"); + getFromSocket("/dispatch hl.dsp.workspace.toggle_special('test_fs_special')"); Tests::killAllWindows(); OK(getFromSocket("/reload")); }}; - getFromSocket("/dispatch workspace 1"); + getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })"); EXPECT(Tests::windowCount(), 0); NLog::log("{}Test 1: Fullscreen detection on special workspace", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace special:test_fs_special")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'special:test_fs_special' })")); if (!Tests::spawnKitty("kitty_special")) return false; @@ -49,7 +49,7 @@ static bool testSpecialWorkspaceFullscreen() { EXPECT_CONTAINS(str, "(special:test_fs_special)"); } - OK(getFromSocket("/dispatch fullscreen 0")); + OK(getFromSocket("/dispatch hl.dsp.window.fullscreen({ mode = 'fullscreen' })")); { auto str = getFromSocket("/activewindow"); @@ -64,13 +64,13 @@ static bool testSpecialWorkspaceFullscreen() { NLog::log("{}Test 2: Special workspace fullscreen precedence", Colors::YELLOW); // Close special workspace before spawning on regular workspace - OK(getFromSocket("/dispatch togglespecialworkspace test_fs_special")); - getFromSocket("/dispatch workspace 1"); + OK(getFromSocket("/dispatch hl.dsp.workspace.toggle_special('test_fs_special')")); + getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })"); if (!Tests::spawnKitty("kitty_regular")) return false; - OK(getFromSocket("/dispatch fullscreen 0")); + OK(getFromSocket("/dispatch hl.dsp.window.fullscreen({ mode = 'fullscreen' })")); { auto str = getFromSocket("/activewindow"); @@ -78,8 +78,8 @@ static bool testSpecialWorkspaceFullscreen() { EXPECT_CONTAINS(str, "fullscreen: 2"); } - OK(getFromSocket("/dispatch togglespecialworkspace test_fs_special")); - OK(getFromSocket("/dispatch focuswindow class:kitty_special")); + OK(getFromSocket("/dispatch hl.dsp.workspace.toggle_special('test_fs_special')")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_special' })")); { auto str = getFromSocket("/activewindow"); @@ -88,8 +88,8 @@ static bool testSpecialWorkspaceFullscreen() { NLog::log("{}Test 3: Toggle special workspace hides it", Colors::YELLOW); - OK(getFromSocket("/dispatch togglespecialworkspace test_fs_special")); - OK(getFromSocket("/dispatch focuswindow class:kitty_regular")); + OK(getFromSocket("/dispatch hl.dsp.workspace.toggle_special('test_fs_special')")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_regular' })")); { auto str = getFromSocket("/activewindow"); @@ -115,74 +115,74 @@ static bool testAsymmetricGaps() { OK(getFromSocket("/reload")); }}; - OK(getFromSocket("/dispatch workspace name:gap_split_test")); - OK(getFromSocket("r/keyword general:gaps_in 0")); - OK(getFromSocket("r/keyword general:border_size 0")); - OK(getFromSocket("r/keyword dwindle:split_width_multiplier 1.0")); - OK(getFromSocket("r/keyword workspace name:gap_split_test,gapsout:0 1000 0 0")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'name:gap_split_test' })")); + OK(getFromSocket("r/eval hl.config({ general = { gaps_in = 0 } })")); + OK(getFromSocket("r/eval hl.config({ general = { border_size = 0 } })")); + OK(getFromSocket("r/eval hl.config({ dwindle = { split_width_multiplier = 1.0 } })")); + OK(getFromSocket("r/eval hl.workspace_rule({ workspace = 'name:gap_split_test', gaps_out = { top = 0, right = 1000, bottom = 0, left = 0 } })")); NLog::log("{}Testing default split (force_split = 0)", Colors::YELLOW); - OK(getFromSocket("r/keyword dwindle:force_split 0")); + OK(getFromSocket("r/eval hl.config({ dwindle = { force_split = 0 } })")); if (!Tests::spawnKitty("gaps_kitty_A") || !Tests::spawnKitty("gaps_kitty_B")) return false; NLog::log("{}Expecting vertical split (B below A)", Colors::YELLOW); - OK(getFromSocket("/dispatch focuswindow class:gaps_kitty_A")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:gaps_kitty_A' })")); EXPECT_CONTAINS(getFromSocket("/activewindow"), "at: 0,0"); - OK(getFromSocket("/dispatch focuswindow class:gaps_kitty_B")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:gaps_kitty_B' })")); EXPECT_CONTAINS(getFromSocket("/activewindow"), "at: 0,540"); Tests::killAllWindows(); EXPECT(Tests::windowCount(), 0); NLog::log("{}Testing force_split = 1", Colors::YELLOW); - OK(getFromSocket("r/keyword dwindle:force_split 1")); + OK(getFromSocket("r/eval hl.config({ dwindle = { force_split = 1 } })")); if (!Tests::spawnKitty("gaps_kitty_A") || !Tests::spawnKitty("gaps_kitty_B")) return false; NLog::log("{}Expecting vertical split (B above A)", Colors::YELLOW); - OK(getFromSocket("/dispatch focuswindow class:gaps_kitty_B")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:gaps_kitty_B' })")); EXPECT_CONTAINS(getFromSocket("/activewindow"), "at: 0,0"); - OK(getFromSocket("/dispatch focuswindow class:gaps_kitty_A")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:gaps_kitty_A' })")); EXPECT_CONTAINS(getFromSocket("/activewindow"), "at: 0,540"); NLog::log("{}Expecting horizontal split (C left of B)", Colors::YELLOW); - OK(getFromSocket("/dispatch focuswindow class:gaps_kitty_B")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:gaps_kitty_B' })")); if (!Tests::spawnKitty("gaps_kitty_C")) return false; - OK(getFromSocket("/dispatch focuswindow class:gaps_kitty_C")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:gaps_kitty_C' })")); EXPECT_CONTAINS(getFromSocket("/activewindow"), "at: 0,0"); - OK(getFromSocket("/dispatch focuswindow class:gaps_kitty_B")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:gaps_kitty_B' })")); EXPECT_CONTAINS(getFromSocket("/activewindow"), "at: 460,0"); Tests::killAllWindows(); EXPECT(Tests::windowCount(), 0); NLog::log("{}Testing force_split = 2", Colors::YELLOW); - OK(getFromSocket("r/keyword dwindle:force_split 2")); + OK(getFromSocket("r/eval hl.config({ dwindle = { force_split = 2 } })")); if (!Tests::spawnKitty("gaps_kitty_A") || !Tests::spawnKitty("gaps_kitty_B")) return false; NLog::log("{}Expecting vertical split (B below A)", Colors::YELLOW); - OK(getFromSocket("/dispatch focuswindow class:gaps_kitty_A")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:gaps_kitty_A' })")); EXPECT_CONTAINS(getFromSocket("/activewindow"), "at: 0,0"); - OK(getFromSocket("/dispatch focuswindow class:gaps_kitty_B")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:gaps_kitty_B' })")); EXPECT_CONTAINS(getFromSocket("/activewindow"), "at: 0,540"); NLog::log("{}Expecting horizontal split (C right of A)", Colors::YELLOW); - OK(getFromSocket("/dispatch focuswindow class:gaps_kitty_A")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:gaps_kitty_A' })")); if (!Tests::spawnKitty("gaps_kitty_C")) return false; - OK(getFromSocket("/dispatch focuswindow class:gaps_kitty_A")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:gaps_kitty_A' })")); EXPECT_CONTAINS(getFromSocket("/activewindow"), "at: 0,0"); - OK(getFromSocket("/dispatch focuswindow class:gaps_kitty_C")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:gaps_kitty_C' })")); EXPECT_CONTAINS(getFromSocket("/activewindow"), "at: 460,0"); } @@ -197,22 +197,22 @@ static void testWorkspaceHistoryMultiMon() { NLog::log("{}Testing multimon workspace history tracker", Colors::YELLOW); // Initial state: - OK(getFromSocket("/dispatch focusmonitor HEADLESS-2")); - OK(getFromSocket("/dispatch workspace 10")); + OK(getFromSocket("/dispatch hl.dsp.focus({ monitor = 'HEADLESS-2' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '10' })")); Tests::spawnKitty(); - OK(getFromSocket("/dispatch workspace 11")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '11' })")); Tests::spawnKitty(); - OK(getFromSocket("/dispatch focusmonitor HEADLESS-3")); - OK(getFromSocket("/dispatch workspace 12")); + OK(getFromSocket("/dispatch hl.dsp.focus({ monitor = 'HEADLESS-3' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '12' })")); Tests::spawnKitty(); - OK(getFromSocket("/dispatch focusmonitor HEADLESS-2")); + OK(getFromSocket("/dispatch hl.dsp.focus({ monitor = 'HEADLESS-2' })")); { auto str = getFromSocket("/activeworkspace"); EXPECT_CONTAINS(str, "workspace ID 11"); } - OK(getFromSocket("/dispatch workspace previous_per_monitor")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'previous_per_monitor' })")); { auto str = getFromSocket("/activeworkspace"); EXPECT_CONTAINS(str, "workspace ID 10"); @@ -225,56 +225,56 @@ static void testWorkspaceHistoryMultiMon() { static void testMultimonBAF() { NLog::log("{}Testing multimon back and forth", Colors::YELLOW); - OK(getFromSocket("/keyword binds:workspace_back_and_forth 1")); + OK(getFromSocket("/eval hl.config({ binds = { workspace_back_and_forth = 1 } })")); - OK(getFromSocket("/dispatch focusmonitor HEADLESS-2")); - OK(getFromSocket("/dispatch workspace 1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ monitor = 'HEADLESS-2' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })")); Tests::spawnKitty(); - OK(getFromSocket("/dispatch workspace 2")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '2' })")); Tests::spawnKitty(); - OK(getFromSocket("/dispatch focusmonitor HEADLESS-3")); - OK(getFromSocket("/dispatch workspace 3")); + OK(getFromSocket("/dispatch hl.dsp.focus({ monitor = 'HEADLESS-3' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '3' })")); Tests::spawnKitty(); - OK(getFromSocket("/dispatch workspace 3")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '3' })")); { auto str = getFromSocket("/activeworkspace"); EXPECT_CONTAINS(str, "workspace ID 2 "); } - OK(getFromSocket("/dispatch workspace 4")); - OK(getFromSocket("/dispatch workspace 4")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '4' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '4' })")); { auto str = getFromSocket("/activeworkspace"); EXPECT_CONTAINS(str, "workspace ID 2 "); } - OK(getFromSocket("/dispatch workspace 2")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '2' })")); { auto str = getFromSocket("/activeworkspace"); EXPECT_CONTAINS(str, "workspace ID 4 "); } - OK(getFromSocket("/dispatch workspace 3")); - OK(getFromSocket("/dispatch workspace 3")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '3' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '3' })")); { auto str = getFromSocket("/activeworkspace"); EXPECT_CONTAINS(str, "workspace ID 4 "); } - OK(getFromSocket("/dispatch workspace 2")); - OK(getFromSocket("/dispatch workspace 3")); - OK(getFromSocket("/dispatch workspace 1")); - OK(getFromSocket("/dispatch workspace 1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '2' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '3' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })")); { auto str = getFromSocket("/activeworkspace"); @@ -287,11 +287,11 @@ static void testMultimonBAF() { static void testMultimonFocus() { NLog::log("{}Testing multimon focus and move", Colors::YELLOW); - OK(getFromSocket("/keyword input:follow_mouse 0")); - OK(getFromSocket("/dispatch focusmonitor HEADLESS-3")); - OK(getFromSocket("/dispatch workspace 8")); - OK(getFromSocket("/dispatch focusmonitor HEADLESS-2")); - OK(getFromSocket("/dispatch workspace 7")); + OK(getFromSocket("/eval hl.config({ input = { follow_mouse = 0 } })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ monitor = 'HEADLESS-3' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '8' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ monitor = 'HEADLESS-2' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '7' })")); for (auto const& win : {"a", "b"}) { if (!Tests::spawnKitty(win)) { @@ -302,8 +302,8 @@ static void testMultimonFocus() { } } - OK(getFromSocket("/dispatch focuswindow class:a")); - OK(getFromSocket("/dispatch movefocus r")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:a' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ direction = 'right' })")); { auto str = getFromSocket("/activeworkspace"); @@ -315,7 +315,7 @@ static void testMultimonFocus() { EXPECT_CONTAINS(str, "class: b"); } - OK(getFromSocket("/dispatch movefocus r")); + OK(getFromSocket("/dispatch hl.dsp.focus({ direction = 'right' })")); { auto str = getFromSocket("/activeworkspace"); @@ -334,7 +334,7 @@ static void testMultimonFocus() { EXPECT_CONTAINS(str, "workspace ID 8 "); } - OK(getFromSocket("/dispatch movefocus l")); + OK(getFromSocket("/dispatch hl.dsp.focus({ direction = 'left' })")); { auto str = getFromSocket("/activewindow"); @@ -346,7 +346,7 @@ static void testMultimonFocus() { EXPECT_CONTAINS(str, "workspace ID 7 "); } - OK(getFromSocket("/dispatch movewindow r")); + OK(getFromSocket("/dispatch hl.dsp.window.move({ direction = 'right' })")); { auto str = getFromSocket("/activewindow"); @@ -358,7 +358,7 @@ static void testMultimonFocus() { EXPECT_CONTAINS(str, "workspace ID 8 "); } - OK(getFromSocket("/dispatch movefocus r")); + OK(getFromSocket("/dispatch hl.dsp.focus({ direction = 'right' })")); { auto str = getFromSocket("/activewindow"); @@ -370,12 +370,12 @@ static void testMultimonFocus() { EXPECT_CONTAINS(str, "workspace ID 8 "); } - OK(getFromSocket("/dispatch movefocus l")); + OK(getFromSocket("/dispatch hl.dsp.focus({ direction = 'left' })")); - OK(getFromSocket("/keyword general:no_focus_fallback true")); - OK(getFromSocket("/keyword binds:window_direction_monitor_fallback false")); + OK(getFromSocket("/eval hl.config({ general = { no_focus_fallback = true } })")); + OK(getFromSocket("/eval hl.config({ binds = { window_direction_monitor_fallback = false } })")); - EXPECT_NOT(getFromSocket("/dispatch movefocus l"), "ok"); + EXPECT_NOT(getFromSocket("/dispatch hl.dsp.focus({ direction = 'left' })"), "ok"); { auto str = getFromSocket("/activewindow"); @@ -387,7 +387,7 @@ static void testMultimonFocus() { EXPECT_CONTAINS(str, "workspace ID 8 "); } - OK(getFromSocket("/dispatch movewindow l")); + OK(getFromSocket("/dispatch hl.dsp.window.move({ direction = 'left' })")); { auto str = getFromSocket("/activewindow"); @@ -407,12 +407,12 @@ static void testMultimonFocus() { static void testDynamicWsEffects() { // test dynamic workspace effects, they shouldn't lag - OK(getFromSocket("/dispatch workspace 69")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '69' })")); Tests::spawnKitty("bitch"); - OK(getFromSocket("r/keyword workspace 69,bordersize:20")); - OK(getFromSocket("r/keyword workspace 69,rounding:false")); + OK(getFromSocket("r/eval hl.workspace_rule({ workspace = '69', border_size = 20 })")); + OK(getFromSocket("r/eval hl.workspace_rule({ workspace = '69', no_rounding = true })")); EXPECT(getFromSocket("/getprop class:bitch border_size"), "20"); EXPECT(getFromSocket("/getprop class:bitch rounding"), "0"); @@ -429,10 +429,10 @@ static bool test() { // test on workspace "window" NLog::log("{}Switching to workspace 1", Colors::YELLOW); - getFromSocket("/dispatch workspace 1"); + getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })"); NLog::log("{}Checking persistent no-mon", Colors::YELLOW); - OK(getFromSocket("r/keyword workspace 966,persistent:1")); + OK(getFromSocket("r/eval hl.workspace_rule({ workspace = '966', persistent = true })")); { auto str = getFromSocket("/workspaces"); @@ -450,7 +450,7 @@ static bool test() { } NLog::log("{}Switching to workspace 3", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace 3")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '3' })")); NLog::log("{}Spawning kittyProc on ws 3", Colors::YELLOW); auto kittyProcB = Tests::spawnKitty(); @@ -461,10 +461,10 @@ static bool test() { } NLog::log("{}Switching to workspace 1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace 1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })")); NLog::log("{}Switching to workspace +1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace +1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '+1' })")); { auto str = getFromSocket("/activeworkspace"); @@ -479,7 +479,7 @@ static bool test() { } NLog::log("{}Switching to workspace 1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace 1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })")); { auto str = getFromSocket("/workspaces"); @@ -487,7 +487,7 @@ static bool test() { } NLog::log("{}Switching to workspace m+1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace m+1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'm+1' })")); { auto str = getFromSocket("/activeworkspace"); @@ -495,7 +495,7 @@ static bool test() { } NLog::log("{}Switching to workspace -1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace -1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '-1' })")); { auto str = getFromSocket("/activeworkspace"); @@ -503,10 +503,10 @@ static bool test() { } NLog::log("{}Switching to workspace 1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace 1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })")); NLog::log("{}Switching to workspace r+1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace r+1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'r+1' })")); { auto str = getFromSocket("/activeworkspace"); @@ -514,7 +514,7 @@ static bool test() { } NLog::log("{}Switching to workspace r+1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace r+1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'r+1' })")); { auto str = getFromSocket("/activeworkspace"); @@ -522,7 +522,7 @@ static bool test() { } NLog::log("{}Switching to workspace r~1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace r~1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'r~1' })")); { auto str = getFromSocket("/activeworkspace"); @@ -530,7 +530,7 @@ static bool test() { } NLog::log("{}Switching to workspace empty", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace empty")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'empty' })")); { auto str = getFromSocket("/activeworkspace"); @@ -538,7 +538,7 @@ static bool test() { } NLog::log("{}Switching to workspace previous", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace previous")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'previous' })")); { auto str = getFromSocket("/activeworkspace"); @@ -546,7 +546,7 @@ static bool test() { } NLog::log("{}Switching to workspace name:TEST_WORKSPACE_NULL", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace name:TEST_WORKSPACE_NULL")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'name:TEST_WORKSPACE_NULL' })")); { auto str = getFromSocket("/activeworkspace"); @@ -554,7 +554,7 @@ static bool test() { } NLog::log("{}Switching to workspace 1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace 1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })")); // add a new monitor NLog::log("{}Adding a new monitor", Colors::YELLOW); @@ -569,7 +569,7 @@ static bool test() { } // focus the first monitor - OK(getFromSocket("/dispatch focusmonitor 0")); + OK(getFromSocket("/dispatch hl.dsp.focus({ monitor = 'HEADLESS-2' })")); { auto str = getFromSocket("/activeworkspace"); @@ -577,7 +577,7 @@ static bool test() { } NLog::log("{}Switching to workspace r+1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace r+1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'r+1' })")); { auto str = getFromSocket("/activeworkspace"); @@ -585,8 +585,8 @@ static bool test() { } NLog::log("{}Switching to workspace r~2", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace 1")); - OK(getFromSocket("/dispatch workspace r~2")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'r~2' })")); { auto str = getFromSocket("/activeworkspace"); @@ -594,7 +594,7 @@ static bool test() { } NLog::log("{}Switching to workspace m+1", Colors::YELLOW); - OK(getFromSocket("/dispatch workspace m+1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'm+1' })")); { auto str = getFromSocket("/activeworkspace"); @@ -603,7 +603,7 @@ static bool test() { NLog::log("{}Switching to workspace 1", Colors::YELLOW); // no OK: this will throw an error as it should - getFromSocket("/dispatch workspace 1"); + getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })"); { auto str = getFromSocket("/activeworkspace"); @@ -611,19 +611,19 @@ static bool test() { } NLog::log("{}Testing back_and_forth", Colors::YELLOW); - OK(getFromSocket("/keyword binds:workspace_back_and_forth true")); - OK(getFromSocket("/dispatch workspace 1")); + OK(getFromSocket("/eval hl.config({ binds = { workspace_back_and_forth = true } })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })")); { auto str = getFromSocket("/activeworkspace"); EXPECT_STARTS_WITH(str, "workspace ID 3 (3)"); } - OK(getFromSocket("/keyword binds:workspace_back_and_forth false")); + OK(getFromSocket("/eval hl.config({ binds = { workspace_back_and_forth = false } })")); NLog::log("{}Testing hide_special_on_workspace_change", Colors::YELLOW); - OK(getFromSocket("/keyword binds:hide_special_on_workspace_change true")); - OK(getFromSocket("/dispatch workspace special:HELLO")); + OK(getFromSocket("/eval hl.config({ binds = { hide_special_on_workspace_change = true } })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'special:HELLO' })")); { auto str = getFromSocket("/monitors"); @@ -632,82 +632,82 @@ static bool test() { } // no OK: will err (it shouldn't prolly but oh well) - getFromSocket("/dispatch workspace 3"); + getFromSocket("/dispatch hl.dsp.focus({ workspace = '3' })"); { auto str = getFromSocket("/monitors"); EXPECT_COUNT_STRING(str, "special workspace: 0 ()", 2); } - OK(getFromSocket("/keyword binds:hide_special_on_workspace_change false")); + OK(getFromSocket("/eval hl.config({ binds = { hide_special_on_workspace_change = false } })")); NLog::log("{}Testing allow_workspace_cycles", Colors::YELLOW); - OK(getFromSocket("/keyword binds:allow_workspace_cycles true")); + OK(getFromSocket("/eval hl.config({ binds = { allow_workspace_cycles = true } })")); - OK(getFromSocket("/dispatch workspace 1")); - OK(getFromSocket("/dispatch workspace 3")); - OK(getFromSocket("/dispatch workspace 1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '3' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })")); - OK(getFromSocket("/dispatch workspace previous")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'previous' })")); { auto str = getFromSocket("/activeworkspace"); EXPECT_STARTS_WITH(str, "workspace ID 3 (3)"); } - OK(getFromSocket("/dispatch workspace previous")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'previous' })")); { auto str = getFromSocket("/activeworkspace"); EXPECT_STARTS_WITH(str, "workspace ID 1 (1)"); } - OK(getFromSocket("/dispatch workspace previous")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = 'previous' })")); { auto str = getFromSocket("/activeworkspace"); EXPECT_STARTS_WITH(str, "workspace ID 3 (3)"); } - OK(getFromSocket("/keyword binds:allow_workspace_cycles false")); + OK(getFromSocket("/eval hl.config({ binds = { allow_workspace_cycles = false } })")); - OK(getFromSocket("/dispatch workspace 1")); + OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })")); NLog::log("{}Killing all windows", Colors::YELLOW); Tests::killAllWindows(); // spawn 3 kitties NLog::log("{}Testing focus_preferred_method", Colors::YELLOW); - OK(getFromSocket("/keyword dwindle:force_split 2")); + OK(getFromSocket("/eval hl.config({ dwindle = { force_split = 2 } })")); Tests::spawnKitty("kitty_A"); Tests::spawnKitty("kitty_B"); Tests::spawnKitty("kitty_C"); - OK(getFromSocket("/keyword dwindle:force_split 0")); + OK(getFromSocket("/eval hl.config({ dwindle = { force_split = 0 } })")); // focus kitty 2: will be top right (dwindle) - OK(getFromSocket("/dispatch focuswindow class:kitty_B")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_B' })")); // resize it to be a bit taller - OK(getFromSocket("/dispatch resizeactive +20 +20")); + OK(getFromSocket("/dispatch hl.dsp.window.resize({ x = 20, y = 20, relative = true })")); // now we test focus methods. - OK(getFromSocket("/keyword binds:focus_preferred_method 0")); + OK(getFromSocket("/eval hl.config({ binds = { focus_preferred_method = 0 } })")); - OK(getFromSocket("/dispatch focuswindow class:kitty_C")); - OK(getFromSocket("/dispatch focuswindow class:kitty_A")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_C' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_A' })")); - OK(getFromSocket("/dispatch movefocus r")); + OK(getFromSocket("/dispatch hl.dsp.focus({ direction = 'right' })")); { auto str = getFromSocket("/activewindow"); EXPECT_CONTAINS(str, "class: kitty_C"); } - OK(getFromSocket("/dispatch focuswindow class:kitty_A")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_A' })")); - OK(getFromSocket("/keyword binds:focus_preferred_method 1")); + OK(getFromSocket("/eval hl.config({ binds = { focus_preferred_method = 1 } })")); - OK(getFromSocket("/dispatch movefocus r")); + OK(getFromSocket("/dispatch hl.dsp.focus({ direction = 'right' })")); { auto str = getFromSocket("/activewindow"); @@ -715,41 +715,41 @@ static bool test() { } NLog::log("{}Testing movefocus_cycles_fullscreen", Colors::YELLOW); - OK(getFromSocket("/dispatch focuswindow class:kitty_A")); - OK(getFromSocket("/dispatch focusmonitor HEADLESS-3")); + OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_A' })")); + OK(getFromSocket("/dispatch hl.dsp.focus({ monitor = 'HEADLESS-3' })")); Tests::spawnKitty("kitty_D"); { auto str = getFromSocket("/activewindow"); EXPECT_CONTAINS(str, "class: kitty_D"); } - OK(getFromSocket("/dispatch focusmonitor l")); + OK(getFromSocket("/dispatch hl.dsp.focus({ monitor = 'l' })")); { auto str = getFromSocket("/activewindow"); EXPECT_CONTAINS(str, "class: kitty_A"); } - OK(getFromSocket("/keyword binds:movefocus_cycles_fullscreen false")); - OK(getFromSocket("/dispatch fullscreen 0")); + OK(getFromSocket("/eval hl.config({ binds = { movefocus_cycles_fullscreen = false } })")); + OK(getFromSocket("/dispatch hl.dsp.window.fullscreen({ mode = 'fullscreen' })")); - OK(getFromSocket("/dispatch movefocus r")); + OK(getFromSocket("/dispatch hl.dsp.focus({ direction = 'right' })")); { auto str = getFromSocket("/activewindow"); EXPECT_CONTAINS(str, "class: kitty_D"); } - OK(getFromSocket("/dispatch focusmonitor l")); + OK(getFromSocket("/dispatch hl.dsp.focus({ monitor = 'l' })")); { auto str = getFromSocket("/activewindow"); EXPECT_CONTAINS(str, "class: kitty_A"); } - OK(getFromSocket("/keyword binds:movefocus_cycles_fullscreen true")); + OK(getFromSocket("/eval hl.config({ binds = { movefocus_cycles_fullscreen = true } })")); - OK(getFromSocket("/dispatch movefocus r")); + OK(getFromSocket("/dispatch hl.dsp.focus({ direction = 'right' })")); { auto str = getFromSocket("/activewindow"); |
