From fbb6cd47c42959cabb98a99f8da91d7efd12036c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 19 Jan 2019 18:54:31 +0100 Subject: [PATCH] module/xkb: log all available layouts at startup --- modules/xkb.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/modules/xkb.c b/modules/xkb.c index 603b3cf..ca1b72a 100644 --- a/modules/xkb.c +++ b/modules/xkb.c @@ -590,12 +590,24 @@ talk_to_xkb(struct module *mod, xcb_connection_t *conn) LOG_DBG("%s: %s", name, enabled ? "enabled" : "disabled"); } - LOG_INFO("layout: %s (%s), caps-lock:%s, num-lock:%s, scroll-lock:%s", - layouts.layouts[m->current].name, - layouts.layouts[m->current].symbol, - caps_lock ? "on" : "off", - num_lock ? "on" : "off", - scroll_lock ? "on" : "off"); + { + char buf[512]; + size_t idx = 0; + + for (size_t i = 0; i < layouts.count; i++) { + idx += snprintf(&buf[idx], sizeof(buf) - idx, "%s%s (%s)%s", + i == m->current ? "*" : "", + layouts.layouts[i].name, + layouts.layouts[i].symbol, + i + 1 < layouts.count ? ", " : ""); + } + + LOG_INFO("layouts: %s, caps-lock:%s, num-lock:%s, scroll-lock:%s", + buf, + caps_lock ? "on" : "off", + num_lock ? "on" : "off", + scroll_lock ? "on" : "off"); + } mtx_lock(&mod->lock); m->layouts = layouts;