mirror of
https://github.com/swaywm/sway.git
synced 2026-04-23 06:46:27 -04:00
Merge 7a93906626 into e40eb338b9
This commit is contained in:
commit
9a024bd3db
6 changed files with 50 additions and 4 deletions
|
|
@ -607,3 +607,23 @@ bool handle_ipc_readable(struct swaybar *bar) {
|
|||
free_ipc_response(resp);
|
||||
return bar_is_dirty;
|
||||
}
|
||||
|
||||
json_object *ipc_get_keyboard_modifiers(struct status_line *status) {
|
||||
uint32_t len = 0;
|
||||
char *buf = ipc_single_command(status->bar->ipc_socketfd,
|
||||
IPC_GET_INPUTS, NULL, &len);
|
||||
json_object *inputs_json = json_tokener_parse(buf);
|
||||
free(buf);
|
||||
if (!inputs_json) {
|
||||
return NULL;
|
||||
}
|
||||
for (size_t i = 0; i < json_object_array_length(inputs_json); i++) {
|
||||
json_object *input_json = json_object_array_get_idx(inputs_json, i);
|
||||
json_object *modifiers_json = NULL;
|
||||
json_object_object_get_ex(input_json, "xkb_modifiers", &modifiers_json);
|
||||
if (modifiers_json) {
|
||||
return modifiers_json;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue