From 463f1ea75d9f1860f1064afba78aec635b0751da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 26 May 2021 21:11:53 +0200 Subject: [PATCH] module/sway-xkb: ignore non-keyboard inputs Closes #51 --- CHANGELOG.md | 2 ++ modules/sway-xkb.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c36baa8..8910271 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ * doc: split up **yambar-modules**(5) into multiple man pages, one for each module (https://codeberg.org/dnkl/yambar/issues/15). * fcft >= 2.4.0 is now required. +* sway-xkb: non-keyboard inputs are now ignored + (https://codeberg.org/dnkl/yambar/issues/51). ### Deprecated diff --git a/modules/sway-xkb.c b/modules/sway-xkb.c index 114a361..83d4d10 100644 --- a/modules/sway-xkb.c +++ b/modules/sway-xkb.c @@ -99,6 +99,15 @@ handle_input_reply(int type, const struct json_object *json, void *_mod) return false; const char *id = json_object_get_string(identifier); + + struct json_object *type; + if (!json_object_object_get_ex(obj, "type", &type)) + return false; + if (strcmp(json_object_get_string(type), "keyboard") != 0) { + LOG_DBG("ignoring non-keyboard input '%s'", id); + continue; + } + struct input *input = NULL; for (size_t i = 0; i < m->num_inputs; i++) { struct input *maybe_input = &m->inputs[i];