summaryrefslogtreecommitdiff
path: root/src/debug/HyprCtl.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-10-26 13:19:37 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-10-26 13:19:37 +0100
commit4aebb73de005e50bb08bacb0bb26ea89e0bd2818 (patch)
treeb153e98d38078f4e4a1d3d0765ea053f1a92e7a7 /src/debug/HyprCtl.cpp
parent46e51a81c4c457078ac144c010d9d4d64d02f9df (diff)
Added hyprctl cursorpos
Diffstat (limited to 'src/debug/HyprCtl.cpp')
-rw-r--r--src/debug/HyprCtl.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index bdfaad16..b43666fe 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -601,6 +601,23 @@ std::string splashRequest() {
return g_pCompositor->m_szCurrentSplash;
}
+std::string cursorPosRequest(HyprCtl::eHyprCtlOutputFormat format) {
+ const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal().floor();
+
+ if (format == HyprCtl::FORMAT_NORMAL) {
+ return getFormat("%i, %i", (int)CURSORPOS.x, (int)CURSORPOS.y);
+ } else {
+ return getFormat(R"#(
+{
+ "x": %i,
+ "y": %i
+}
+)#", (int)CURSORPOS.x, (int)CURSORPOS.y);
+ }
+
+ return "error";
+}
+
std::string getReply(std::string);
std::string dispatchBatch(std::string request) {
@@ -767,6 +784,8 @@ std::string getReply(std::string request) {
return devicesRequest(format);
else if (request == "splash")
return splashRequest();
+ else if (request == "cursorpos")
+ return cursorPosRequest(format);
else if (request.find("dispatch") == 0)
return dispatchRequest(request);
else if (request.find("keyword") == 0)