diff --git a/src/keyboard.c b/src/keyboard.c index d2bdb83..184ee18 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -163,6 +163,8 @@ static void kbd_clear_oneshots(struct keyboard *kbd) if (!al->oneshot) kbd->active_layers[n++] = *al; + else + dbg("Clearing oneshot layer %s", kbd->config.layers[al->layer].name); } kbd->nr_active_layers = n; diff --git a/src/keyd.c b/src/keyd.c index 3e05b11..93f156a 100644 --- a/src/keyd.c +++ b/src/keyd.c @@ -231,6 +231,9 @@ void set_mods(uint16_t mods) uint16_t diff = mods ^ state; + if (debug && diff) + fprintf(stderr, "Active mods: %s\n", modstring(mods)); + if (MOD_CTRL & diff) send_key(KEY_LEFTCTRL, !!(MOD_CTRL & mods)); if (MOD_ALT_GR & diff) diff --git a/src/keys.c b/src/keys.c index 19b4c5d..d096bc0 100644 --- a/src/keys.c +++ b/src/keys.c @@ -44,6 +44,43 @@ uint16_t keycode_to_mod(uint16_t code) return 0; } +const char *modstring(uint16_t mods) +{ + static char s[16]; + int i = 0; + s[0] = 0; + + if (MOD_CTRL & mods) { + s[i++] = 'C'; + s[i++] = '-'; + } + + if (MOD_SUPER & mods) { + s[i++] = 'M'; + s[i++] = '-'; + } + + if (MOD_ALT_GR & mods) { + s[i++] = 'G'; + s[i++] = '-'; + } + + if (MOD_SHIFT & mods) { + s[i++] = 'S'; + s[i++] = '-'; + } + + if (MOD_ALT & mods) { + s[i++] = 'A'; + s[i++] = '-'; + } + + if(i) + s[i-1] = 0; + + return s; +} + int parse_modset(const char *s, uint16_t *mods) { *mods = 0; diff --git a/src/keys.h b/src/keys.h index 442724e..3049dbc 100644 --- a/src/keys.h +++ b/src/keys.h @@ -44,6 +44,8 @@ uint16_t keycode_to_mod(uint16_t code); int parse_modset(const char *s, uint16_t *mods); +const char *modstring(uint16_t mods); + struct keycode_table_ent { const char *name; const char *alt_name;