diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-02-10 15:37:24 -0500 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-02-11 01:07:11 +0100 |
commit | a64a3ee6bbd3b880c32bbd9c9a38420d04748dd2 (patch) | |
tree | f76005c6ef9cd50c253c62a1aee992d0ecce6f04 /swaymsg | |
parent | view: remove pointer constraints on unmap (diff) | |
download | sway-a64a3ee6bbd3b880c32bbd9c9a38420d04748dd2.tar.gz sway-a64a3ee6bbd3b880c32bbd9c9a38420d04748dd2.tar.zst sway-a64a3ee6bbd3b880c32bbd9c9a38420d04748dd2.zip |
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)`.
Diffstat (limited to 'swaymsg')
-rw-r--r-- | swaymsg/main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/swaymsg/main.c b/swaymsg/main.c index c84f5671..716d2d2e 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c | |||
@@ -135,8 +135,8 @@ static void pretty_print_input(json_object *i) { | |||
135 | json_object_get_int(vendor)); | 135 | json_object_get_int(vendor)); |
136 | 136 | ||
137 | if (json_object_object_get_ex(i, "xkb_active_layout_name", &kbdlayout)) { | 137 | if (json_object_object_get_ex(i, "xkb_active_layout_name", &kbdlayout)) { |
138 | printf(" Active Keyboard Layout: %s\n", | 138 | const char *layout = json_object_get_string(kbdlayout); |
139 | json_object_get_string(kbdlayout)); | 139 | printf(" Active Keyboard Layout: %s\n", layout ? layout : "(unnamed)"); |
140 | } | 140 | } |
141 | 141 | ||
142 | if (json_object_object_get_ex(i, "libinput_send_events", &events)) { | 142 | if (json_object_object_get_ex(i, "libinput_send_events", &events)) { |