keybinds: fix repeat and long press keybinds release (#11863)

This commit is contained in:
rfresh2 2025-10-06 12:10:56 -07:00 committed by GitHub
parent 17e77e0407
commit 73f06434a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 477 additions and 19 deletions

View file

@ -9,10 +9,15 @@
using namespace Hyprutils::OS;
using namespace Hyprutils::Memory;
CUniquePointer<CProcess> Tests::spawnKitty(const std::string& class_) {
CUniquePointer<CProcess> Tests::spawnKitty(const std::string& class_, const std::vector<std::string> args) {
const auto COUNT_BEFORE = windowCount();
CUniquePointer<CProcess> kitty = makeUnique<CProcess>("kitty", class_.empty() ? std::vector<std::string>{} : std::vector<std::string>{"--class", class_});
std::vector<std::string> programArgs = args;
if (!class_.empty()) {
programArgs.insert(programArgs.begin(), "--class");
programArgs.insert(programArgs.begin() + 1, class_);
}
CUniquePointer<CProcess> kitty = makeUnique<CProcess>("kitty", programArgs);
kitty->addEnv("WAYLAND_DISPLAY", WLDISPLAY);
kitty->runAsync();
@ -49,7 +54,7 @@ int Tests::countOccurrences(const std::string& in, const std::string& what) {
auto pos = in.find(what);
while (pos != std::string::npos) {
cnt++;
pos = in.find(what, pos + what.length() - 1);
pos = in.find(what, pos + what.length());
}
return cnt;
@ -90,3 +95,13 @@ void Tests::waitUntilWindowsN(int n) {
}
}
}
std::string Tests::execAndGet(const std::string& cmd) {
CProcess proc("/bin/sh", {"-c", cmd});
if (!proc.runSync()) {
return "error";
}
return proc.stdOut();
}