mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-25 13:14:13 -04:00
feat(ipc): add 'get cursorpos' to mmsg
This commit is contained in:
parent
b3cbd650eb
commit
722f6ab7bb
4 changed files with 17 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue