From e0c571005912c342d8d812b368bc490cb6f28796 Mon Sep 17 00:00:00 2001 From: Virt <41426325+VirtCode@users.noreply.github.com> Date: Fri, 6 Mar 2026 21:11:42 +0100 Subject: layerrules: add dynamically registered rules for plugins (#13331) * layerrules: add dynamically registered rules for plugins * be gone * layerrules: add layer tests with waybar * fix: use kitty layers instead of waybar --- hyprtester/src/tests/main/layer.cpp | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 hyprtester/src/tests/main/layer.cpp (limited to 'hyprtester/src/tests/main/layer.cpp') diff --git a/hyprtester/src/tests/main/layer.cpp b/hyprtester/src/tests/main/layer.cpp new file mode 100644 index 00000000..73e30ba6 --- /dev/null +++ b/hyprtester/src/tests/main/layer.cpp @@ -0,0 +1,53 @@ +#include "../../Log.hpp" +#include "../shared.hpp" +#include "tests.hpp" +#include "../../shared.hpp" +#include "../../hyprctlCompat.hpp" +#include +#include + +static int ret = 0; + +using namespace Hyprutils::OS; +using namespace Hyprutils::Memory; + +static bool spawnLayer(const std::string& namespace_) { + NLog::log("{}Spawning kitty layer {}", Colors::YELLOW, namespace_); + if (!Tests::spawnLayerKitty(namespace_)) { + NLog::log("{}Error: {} layer did not spawn", Colors::RED, namespace_); + return false; + } + return true; +} + +static bool test() { + NLog::log("{}Testing plugin layerrules", Colors::GREEN); + + if (!spawnLayer("rule-layer")) + return false; + + OK(getFromSocket("/dispatch plugin:test:add_layer_rule")); + OK(getFromSocket("/reload")); + + OK(getFromSocket("/keyword layerrule match:namespace rule-layer, plugin_rule effect")); + + if (!spawnLayer("rule-layer")) + return false; + + if (!spawnLayer("norule-layer")) + return false; + + OK(getFromSocket("/dispatch plugin:test:check_layer_rule")); + + OK(getFromSocket("/reload")); + + NLog::log("{}Killing all layers", Colors::YELLOW); + Tests::killAllLayers(); + + NLog::log("{}Expecting 0 layers", Colors::YELLOW); + EXPECT(Tests::layerCount(), 0); + + return !ret; +} + +REGISTER_TEST_FN(test) -- cgit v1.2.3