3
0
mirror of https://github.com/hyprwm/Hyprland.git synced 2026-02-04 13:15:38 +00:00

layout: fit floating window on toggle to float (#12139)

This commit is contained in:
Vaxry
2025-10-29 23:21:28 +00:00
committed by GitHub
parent 83a0a62004
commit 6ade4d58ca
6 changed files with 108 additions and 10 deletions

View File

@ -0,0 +1,53 @@
#include "../shared.hpp"
#include "../../shared.hpp"
#include "../../hyprctlCompat.hpp"
#include "tests.hpp"
static int ret = 0;
static void testFloatClamp() {
for (auto const& win : {"a", "b", "c"}) {
if (!Tests::spawnKitty(win)) {
NLog::log("{}Failed to spawn kitty with win class `{}`", Colors::RED, win);
++TESTS_FAILED;
ret = 1;
return;
}
}
OK(getFromSocket("/keyword dwindle:force_split 2"));
OK(getFromSocket("/dispatch focuswindow class:c"));
OK(getFromSocket("/dispatch setfloating class:c"));
OK(getFromSocket("/dispatch resizewindowpixel exact 1200 900,class:c"));
OK(getFromSocket("/dispatch settiled class:c"));
OK(getFromSocket("/dispatch setfloating class:c"));
{
auto str = getFromSocket("/clients");
EXPECT_CONTAINS(str, "at: 718,178");
EXPECT_CONTAINS(str, "size: 1200,900");
}
OK(getFromSocket("/keyword dwindle:force_split 0"));
// clean up
NLog::log("{}Killing all windows", Colors::YELLOW);
Tests::killAllWindows();
}
static bool test() {
NLog::log("{}Testing Dwindle layout", Colors::GREEN);
// test
NLog::log("{}Testing float clamp", Colors::GREEN);
testFloatClamp();
// clean up
NLog::log("Cleaning up", Colors::YELLOW);
getFromSocket("/dispatch workspace 1");
OK(getFromSocket("/reload"));
return !ret;
}
REGISTER_TEST_FN(test);

View File

@ -45,11 +45,15 @@ static bool test() {
EXPECT(Tests::windowCount(), 1);
// Give the shell a moment to initialize
std::this_thread::sleep_for(std::chrono::milliseconds(100));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
OK(getFromSocket("/dispatch plugin:test:gesture up,4"));
OK(getFromSocket("/dispatch plugin:test:gesture up,5"));
OK(getFromSocket("/dispatch plugin:test:gesture down,5"));
OK(getFromSocket("/dispatch plugin:test:gesture left,5"));
OK(getFromSocket("/dispatch plugin:test:gesture right,5"));
OK(getFromSocket("/dispatch plugin:test:gesture right,4"));
EXPECT(waitForWindowCount(0, "Gesture sent ctrl+d to kitty"), true);
EXPECT(waitForWindowCount(0, "Gesture sent paste exit + enter to kitty"), true);
EXPECT(Tests::windowCount(), 0);

View File

@ -350,7 +350,11 @@ gesture = 3, down, mod:ALT, float
gesture = 3, horizontal, mod:ALT, workspace
gesture = 4, up, dispatcher, sendshortcut, ctrl, d, activewindow
gesture = 5, up, dispatcher, sendshortcut, , e, activewindow
gesture = 5, down, dispatcher, sendshortcut, , x, activewindow
gesture = 5, left, dispatcher, sendshortcut, , i, activewindow
gesture = 5, right, dispatcher, sendshortcut, , t, activewindow
gesture = 4, right, dispatcher, sendshortcut, , return, activewindow
gesture = 4, left, dispatcher, movecursortocorner, 1
windowrule = float, pin, class:wr_kitty