desktop/windowRule: allow expression in min_size/max_size (#12977)
This commit is contained in:
parent
e7985ca4c4
commit
22fc8136a2
4 changed files with 48 additions and 10 deletions
|
|
@ -77,6 +77,16 @@ static bool testGetprop() {
|
|||
EXPECT(getCommandStdOut("hyprctl getprop class:kitty min_size"), "100 50");
|
||||
EXPECT(getCommandStdOut("hyprctl getprop class:kitty min_size -j"), R"({"min_size": [100,50]})");
|
||||
|
||||
// expr-based min/max _size
|
||||
getFromSocket("/dispatch setfloating class:kitty"); // need to set floating for tests below
|
||||
getFromSocket("/dispatch setprop class:kitty max_size 90+10 25*2"); // set max to the same as min above, forcing window to 100*50
|
||||
EXPECT(getCommandStdOut("hyprctl getprop class:kitty max_size"), "100 50");
|
||||
EXPECT(getCommandStdOut("hyprctl getprop class:kitty max_size -j"), R"({"max_size": [100,50]})");
|
||||
getFromSocket("/dispatch setprop class:kitty min_size window_w*0.5 window_h-10");
|
||||
EXPECT(getCommandStdOut("hyprctl getprop class:kitty min_size"), "50 40");
|
||||
EXPECT(getCommandStdOut("hyprctl getprop class:kitty min_size -j"), R"({"min_size": [50,40]})");
|
||||
getFromSocket("/dispatch settiled class:kitty"); // go back to tiled for consistency
|
||||
|
||||
// opacity
|
||||
EXPECT(getCommandStdOut("hyprctl getprop class:kitty opacity"), "1");
|
||||
EXPECT(getCommandStdOut("hyprctl getprop class:kitty opacity -j"), R"({"opacity": 1})");
|
||||
|
|
|
|||
|
|
@ -970,7 +970,8 @@ static bool test() {
|
|||
Tests::killAllWindows();
|
||||
|
||||
// test expression rules
|
||||
OK(getFromSocket("/keyword windowrule match:class expr_kitty, float yes, size monitor_w*0.5 monitor_h*0.5, move 20+(monitor_w*0.1) monitor_h*0.5"));
|
||||
OK(getFromSocket("/keyword windowrule match:class expr_kitty, float yes, size monitor_w*0.5 monitor_h*0.5, min_size monitor_w*0.25 monitor_h*0.25, "
|
||||
"max_size monitor_w*0.75 monitor_h*0.75, move 20+(monitor_w*0.1) monitor_h*0.5"));
|
||||
|
||||
if (!spawnKitty("expr_kitty"))
|
||||
return false;
|
||||
|
|
@ -980,6 +981,14 @@ static bool test() {
|
|||
EXPECT_CONTAINS(str, "floating: 1");
|
||||
EXPECT_CONTAINS(str, "at: 212,540");
|
||||
EXPECT_CONTAINS(str, "size: 960,540");
|
||||
|
||||
auto min = getFromSocket("/getprop active min_size");
|
||||
EXPECT_CONTAINS(min, "480");
|
||||
EXPECT_CONTAINS(min, "270");
|
||||
|
||||
auto max = getFromSocket("/getprop active max_size");
|
||||
EXPECT_CONTAINS(max, "1440");
|
||||
EXPECT_CONTAINS(max, "810");
|
||||
}
|
||||
|
||||
OK(getFromSocket("/reload"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue