summaryrefslogtreecommitdiff
path: root/hyprtester/src/tests/main/gestures.cpp
diff options
context:
space:
mode:
authorNikolai Nechaev <nikolay_nechaev@mail.ru>2025-12-06 05:43:30 +0900
committerGitHub <noreply@github.com>2025-12-05 20:43:30 +0000
commit222dbe99d0d2d8a61f3b3202f8ef1794b0b081b7 (patch)
tree1c78deebddc7b7e8a777d6251bda73a886f796fc /hyprtester/src/tests/main/gestures.cpp
parentebe74be75a86edd69340c44a910108c84ae38dce (diff)
keybinds: fix previous workspace remembering (#12399)
* swipe: Fix previous workspace remembering in workspace gesture Fixes a bug that previous workspace does not exist after swiping to a workspace * tests: Test that `workspace previous` works after workspace gesture * moveActiveToWorkspace: remember previous workspace unconditionally
Diffstat (limited to 'hyprtester/src/tests/main/gestures.cpp')
-rw-r--r--hyprtester/src/tests/main/gestures.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/hyprtester/src/tests/main/gestures.cpp b/hyprtester/src/tests/main/gestures.cpp
index 9b31cdb6..07cc4ca9 100644
--- a/hyprtester/src/tests/main/gestures.cpp
+++ b/hyprtester/src/tests/main/gestures.cpp
@@ -160,6 +160,33 @@ static bool test() {
// The cursor should have moved because of the gesture
EXPECT(cursorPos1 != cursorPos2, true);
+ // Test that `workspace previous` works correctly after a workspace gesture.
+ {
+ OK(getFromSocket("/keyword gestures:workspace_swipe_invert 0"));
+ OK(getFromSocket("/keyword gestures:workspace_swipe_create_new 1"));
+ OK(getFromSocket("/dispatch workspace 3"));
+
+ // Come to workspace 5 from workspace 3: 5 will remember that.
+ OK(getFromSocket("/dispatch workspace 5"));
+ Tests::spawnKitty(); // Keep workspace 5 open
+
+ // Swipe from 1 to 5: 5 shall remember that.
+ OK(getFromSocket("/dispatch workspace 1"));
+ OK(getFromSocket("/dispatch plugin:test:alt 1"));
+ OK(getFromSocket("/dispatch plugin:test:gesture right,3"));
+ OK(getFromSocket("/dispatch plugin:test:alt 0"));
+ EXPECT_CONTAINS(getFromSocket("/activeworkspace"), "ID 5 (5)");
+
+ // Must return to 1 rather than 3
+ OK(getFromSocket("/dispatch workspace previous"));
+ EXPECT_CONTAINS(getFromSocket("/activeworkspace"), "ID 1 (1)");
+
+ OK(getFromSocket("/dispatch workspace previous"));
+ EXPECT_CONTAINS(getFromSocket("/activeworkspace"), "ID 5 (5)");
+
+ OK(getFromSocket("/dispatch workspace 1"));
+ }
+
// kill all
NLog::log("{}Killing all windows", Colors::YELLOW);
Tests::killAllWindows();