mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 19:05:59 +01:00
added hyprctl seterror
This commit is contained in:
parent
7d754b7c22
commit
8f57db28f7
2 changed files with 70 additions and 41 deletions
|
@ -341,6 +341,8 @@ int main(int argc, char** argv) {
|
||||||
request(fullRequest);
|
request(fullRequest);
|
||||||
else if (fullRequest.contains("/switchxkblayout"))
|
else if (fullRequest.contains("/switchxkblayout"))
|
||||||
request(fullRequest, 2);
|
request(fullRequest, 2);
|
||||||
|
else if (fullRequest.contains("/seterror"))
|
||||||
|
request(fullRequest, 1);
|
||||||
else if (fullRequest.contains("/output"))
|
else if (fullRequest.contains("/output"))
|
||||||
exitStatus = outputRequest(argc, argv);
|
exitStatus = outputRequest(argc, argv);
|
||||||
else if (fullRequest.contains("/setcursor"))
|
else if (fullRequest.contains("/setcursor"))
|
||||||
|
|
|
@ -805,6 +805,31 @@ std::string switchXKBLayoutRequest(const std::string& request) {
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string dispatchSeterror(std::string request) {
|
||||||
|
CVarList vars(request, 0, ' ');
|
||||||
|
|
||||||
|
std::string errorMessage = "";
|
||||||
|
|
||||||
|
if (vars.size() < 3) {
|
||||||
|
g_pHyprError->destroy();
|
||||||
|
return "ok";
|
||||||
|
}
|
||||||
|
|
||||||
|
const CColor COLOR = configStringToInt(vars[1]);
|
||||||
|
|
||||||
|
for (size_t i = 2; i < vars.size(); ++i)
|
||||||
|
errorMessage += vars[i] + ' ';
|
||||||
|
|
||||||
|
if (errorMessage.empty()) {
|
||||||
|
g_pHyprError->destroy();
|
||||||
|
} else {
|
||||||
|
errorMessage.pop_back(); // pop last space
|
||||||
|
g_pHyprError->queueCreate(errorMessage, COLOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "ok";
|
||||||
|
}
|
||||||
|
|
||||||
std::string dispatchGetOption(std::string request, HyprCtl::eHyprCtlOutputFormat format) {
|
std::string dispatchGetOption(std::string request, HyprCtl::eHyprCtlOutputFormat format) {
|
||||||
std::string curitem = "";
|
std::string curitem = "";
|
||||||
|
|
||||||
|
@ -973,6 +998,8 @@ std::string getReply(std::string request) {
|
||||||
return cursorPosRequest(format);
|
return cursorPosRequest(format);
|
||||||
else if (request == "binds")
|
else if (request == "binds")
|
||||||
return bindsRequest(format);
|
return bindsRequest(format);
|
||||||
|
else if (request.find("seterror") == 0)
|
||||||
|
return dispatchSeterror(request);
|
||||||
else if (request.find("switchxkblayout") == 0)
|
else if (request.find("switchxkblayout") == 0)
|
||||||
return switchXKBLayoutRequest(request);
|
return switchXKBLayoutRequest(request);
|
||||||
else if (request.find("output") == 0)
|
else if (request.find("output") == 0)
|
||||||
|
|
Loading…
Reference in a new issue