feat(ipc): add 'get cursorpos' to mmsg

This commit is contained in:
Ernesto Cruz 2026-06-20 00:23:54 +01:00 committed by DreamMaoMao
parent b3cbd650eb
commit 722f6ab7bb
4 changed files with 17 additions and 0 deletions

View file

@ -237,6 +237,15 @@ static void handle_command(int client_fd, const char *cmd_raw) {
if (strcmp(cmd, "get version") == 0) {
resp = cJSON_CreateObject();
cJSON_AddStringToObject(resp, "version", VERSION);
} else if (strcmp(cmd, "get cursorpos") == 0) {
resp = cJSON_CreateObject();
cJSON_AddNumberToObject(resp, "x", cursor->x);
cJSON_AddNumberToObject(resp, "y", cursor->y);
Monitor *m = xytomon(cursor->x, cursor->y);
if (m)
cJSON_AddStringToObject(resp, "monitor", m->wlr_output->name);
else
cJSON_AddNullToObject(resp, "monitor");
} else if (strcmp(cmd, "get keymode") == 0) {
resp = cJSON_CreateObject();
cJSON_AddStringToObject(resp, "keymode", keymode.mode);