summaryrefslogtreecommitdiff
path: root/src/debug/HyprCtl.cpp
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2023-01-22 16:38:17 +0100
committervaxerski <vaxry@vaxry.net>2023-01-22 16:38:17 +0100
commit8f57db28f7a2376a2e43bef79e94cc844931e0a6 (patch)
treeead2fe4d4d468da45e42b8099fdab554e63e411f /src/debug/HyprCtl.cpp
parent7d754b7c22a2e49126e4d49b6240a7ff7d38c976 (diff)
added hyprctl seterror
Diffstat (limited to 'src/debug/HyprCtl.cpp')
-rw-r--r--src/debug/HyprCtl.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index 4db5bafb..f5494415 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -805,6 +805,31 @@ std::string switchXKBLayoutRequest(const std::string& request) {
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 curitem = "";
@@ -973,6 +998,8 @@ std::string getReply(std::string request) {
return cursorPosRequest(format);
else if (request == "binds")
return bindsRequest(format);
+ else if (request.find("seterror") == 0)
+ return dispatchSeterror(request);
else if (request.find("switchxkblayout") == 0)
return switchXKBLayoutRequest(request);
else if (request.find("output") == 0)