From a64a3ee6bbd3b880c32bbd9c9a38420d04748dd2 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Sun, 10 Feb 2019 15:37:24 -0500 Subject: ipc: handle unnamed xkb_active_layout_name If the active xkb_layout does not have a name, use `NULL` instead of `json_object_new_string(NULL)`. This also makes it so swaymsg will pretty print this as `(unnamed)`. --- sway/ipc-json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sway/ipc-json.c') diff --git a/sway/ipc-json.c b/sway/ipc-json.c index e1098942..23016dbd 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -597,7 +597,7 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) { const char *layout = xkb_keymap_layout_get_name(keymap, layout_idx); json_object_object_add(object, "xkb_active_layout_name", - json_object_new_string(layout)); + layout ? json_object_new_string(layout) : NULL); break; } } -- cgit v1.2.3