hyprctl: add an active layout index field in devices (#11531)
This commit is contained in:
parent
ecc9e4d8cd
commit
150d693fe7
4 changed files with 64 additions and 23 deletions
|
|
@ -1,7 +1,9 @@
|
|||
#include "tests.hpp"
|
||||
#include "../../shared.hpp"
|
||||
#include "../../hyprctlCompat.hpp"
|
||||
#include <cstdint>
|
||||
#include <print>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <hyprutils/os/Process.hpp>
|
||||
|
|
@ -29,6 +31,24 @@ static std::string getCommandStdOut(std::string command) {
|
|||
return stdOut.substr(0, stdOut.length() - 1);
|
||||
}
|
||||
|
||||
static bool testDevicesActiveLayoutIndex() {
|
||||
NLog::log("{}Testing hyprctl devices active_layout_index", Colors::GREEN);
|
||||
|
||||
// configure layouts
|
||||
getFromSocket("/keyword input:kb_layout us,pl,ua");
|
||||
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
// set layout
|
||||
getFromSocket("/switchxkblayout all " + std::to_string(i));
|
||||
std::string devicesJson = getFromSocket("j/devices");
|
||||
std::string expected = R"("active_layout_index": )" + std::to_string(i);
|
||||
// check layout index
|
||||
EXPECT_CONTAINS(devicesJson, expected);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool testGetprop() {
|
||||
NLog::log("{}Testing hyprctl getprop", Colors::GREEN);
|
||||
if (!Tests::spawnKitty()) {
|
||||
|
|
@ -154,8 +174,9 @@ static bool test() {
|
|||
EXPECT(jqProc.exitCode(), 0);
|
||||
}
|
||||
|
||||
if (!testGetprop())
|
||||
return false;
|
||||
testGetprop();
|
||||
testDevicesActiveLayoutIndex();
|
||||
getFromSocket("/reload");
|
||||
|
||||
return !ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue