algo/scrolling: add config options for focus and swapcol wrapping (#13518)
This commit is contained in:
parent
803e81ac39
commit
3284dd729b
5 changed files with 180 additions and 6 deletions
|
|
@ -57,6 +57,147 @@ static void testFocusCycling() {
|
|||
Tests::killAllWindows();
|
||||
}
|
||||
|
||||
static void testFocusWrapping() {
|
||||
for (auto const& win : {"a", "b", "c", "d"}) {
|
||||
if (!Tests::spawnKitty(win)) {
|
||||
NLog::log("{}Failed to spawn kitty with win class `{}`", Colors::RED, win);
|
||||
++TESTS_FAILED;
|
||||
ret = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// set wrap_focus to true
|
||||
OK(getFromSocket("/keyword scrolling:wrap_focus true"));
|
||||
|
||||
OK(getFromSocket("/dispatch focuswindow class:a"));
|
||||
|
||||
OK(getFromSocket("/dispatch layoutmsg focus l"));
|
||||
|
||||
{
|
||||
auto str = getFromSocket("/activewindow");
|
||||
EXPECT_CONTAINS(str, "class: d");
|
||||
}
|
||||
|
||||
OK(getFromSocket("/dispatch layoutmsg focus r"));
|
||||
|
||||
{
|
||||
auto str = getFromSocket("/activewindow");
|
||||
EXPECT_CONTAINS(str, "class: a");
|
||||
}
|
||||
|
||||
// set wrap_focus to false
|
||||
OK(getFromSocket("/keyword scrolling:wrap_focus false"));
|
||||
|
||||
OK(getFromSocket("/dispatch focuswindow class:a"));
|
||||
|
||||
OK(getFromSocket("/dispatch layoutmsg focus l"));
|
||||
|
||||
{
|
||||
auto str = getFromSocket("/activewindow");
|
||||
EXPECT_CONTAINS(str, "class: a");
|
||||
}
|
||||
|
||||
OK(getFromSocket("/dispatch focuswindow class:d"));
|
||||
|
||||
OK(getFromSocket("/dispatch layoutmsg focus r"));
|
||||
|
||||
{
|
||||
auto str = getFromSocket("/activewindow");
|
||||
EXPECT_CONTAINS(str, "class: d");
|
||||
}
|
||||
|
||||
// clean up
|
||||
NLog::log("{}Killing all windows", Colors::YELLOW);
|
||||
Tests::killAllWindows();
|
||||
}
|
||||
|
||||
static void testSwapcolWrapping() {
|
||||
for (auto const& win : {"a", "b", "c", "d"}) {
|
||||
if (!Tests::spawnKitty(win)) {
|
||||
NLog::log("{}Failed to spawn kitty with win class `{}`", Colors::RED, win);
|
||||
++TESTS_FAILED;
|
||||
ret = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// set wrap_swapcol to true
|
||||
OK(getFromSocket("/keyword scrolling:wrap_swapcol true"));
|
||||
|
||||
OK(getFromSocket("/dispatch focuswindow class:a"));
|
||||
|
||||
OK(getFromSocket("/dispatch layoutmsg swapcol l"));
|
||||
OK(getFromSocket("/dispatch layoutmsg focus l"));
|
||||
|
||||
{
|
||||
auto str = getFromSocket("/activewindow");
|
||||
EXPECT_CONTAINS(str, "class: c");
|
||||
}
|
||||
|
||||
// clean up
|
||||
NLog::log("{}Killing all windows", Colors::YELLOW);
|
||||
Tests::killAllWindows();
|
||||
|
||||
for (auto const& win : {"a", "b", "c", "d"}) {
|
||||
if (!Tests::spawnKitty(win)) {
|
||||
NLog::log("{}Failed to spawn kitty with win class `{}`", Colors::RED, win);
|
||||
++TESTS_FAILED;
|
||||
ret = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
OK(getFromSocket("/dispatch focuswindow class:d"));
|
||||
OK(getFromSocket("/dispatch layoutmsg swapcol r"));
|
||||
OK(getFromSocket("/dispatch layoutmsg focus r"));
|
||||
|
||||
{
|
||||
auto str = getFromSocket("/activewindow");
|
||||
EXPECT_CONTAINS(str, "class: b");
|
||||
}
|
||||
|
||||
// clean up
|
||||
NLog::log("{}Killing all windows", Colors::YELLOW);
|
||||
Tests::killAllWindows();
|
||||
|
||||
for (auto const& win : {"a", "b", "c", "d"}) {
|
||||
if (!Tests::spawnKitty(win)) {
|
||||
NLog::log("{}Failed to spawn kitty with win class `{}`", Colors::RED, win);
|
||||
++TESTS_FAILED;
|
||||
ret = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// set wrap_swapcol to false
|
||||
OK(getFromSocket("/keyword scrolling:wrap_swapcol false"));
|
||||
|
||||
OK(getFromSocket("/dispatch focuswindow class:a"));
|
||||
|
||||
OK(getFromSocket("/dispatch layoutmsg swapcol l"));
|
||||
OK(getFromSocket("/dispatch layoutmsg focus r"));
|
||||
|
||||
{
|
||||
auto str = getFromSocket("/activewindow");
|
||||
EXPECT_CONTAINS(str, "class: b");
|
||||
}
|
||||
|
||||
OK(getFromSocket("/dispatch focuswindow class:d"));
|
||||
|
||||
OK(getFromSocket("/dispatch layoutmsg swapcol r"));
|
||||
OK(getFromSocket("/dispatch layoutmsg focus l"));
|
||||
|
||||
{
|
||||
auto str = getFromSocket("/activewindow");
|
||||
EXPECT_CONTAINS(str, "class: c");
|
||||
}
|
||||
|
||||
// clean up
|
||||
NLog::log("{}Killing all windows", Colors::YELLOW);
|
||||
Tests::killAllWindows();
|
||||
}
|
||||
|
||||
static bool test() {
|
||||
NLog::log("{}Testing Scroll layout", Colors::GREEN);
|
||||
|
||||
|
|
@ -68,6 +209,14 @@ static bool test() {
|
|||
NLog::log("{}Testing focus cycling", Colors::GREEN);
|
||||
testFocusCycling();
|
||||
|
||||
// test
|
||||
NLog::log("{}Testing focus wrap", Colors::GREEN);
|
||||
testFocusWrapping();
|
||||
|
||||
// test
|
||||
NLog::log("{}Testing swapcol wrap", Colors::GREEN);
|
||||
testSwapcolWrapping();
|
||||
|
||||
// clean up
|
||||
NLog::log("Cleaning up", Colors::YELLOW);
|
||||
OK(getFromSocket("/dispatch workspace 1"));
|
||||
|
|
|
|||
|
|
@ -186,6 +186,8 @@ scrolling {
|
|||
follow_focus = true
|
||||
follow_min_visible = 1
|
||||
explicit_column_widths = 0.25, 0.333, 0.5, 0.667, 0.75, 1.0
|
||||
wrap_focus = true
|
||||
wrap_swapcol = true
|
||||
}
|
||||
|
||||
# https://wiki.hyprland.org/Configuring/Variables/#misc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue