diff --git a/src/client.cc b/src/client.cc index 6019f391..c95e8281 100644 --- a/src/client.cc +++ b/src/client.cc @@ -77,8 +77,14 @@ void Client::handle_available_input(EventMode mode) try { + const bool debug_keys = (bool)(context().options()["debug"].get() & DebugFlags::Keys); + while (Optional key = get_next_key(mode)) { + if (debug_keys) + write_to_debug_buffer(format("Client '{}' got key '{}'", + context().name(), key_to_str(*key))); + if (*key == ctrl('c')) killpg(getpgrp(), SIGINT); else if (*key == Key::FocusIn) diff --git a/src/option_types.hh b/src/option_types.hh index a37f37f3..b0d9b054 100644 --- a/src/option_types.hh +++ b/src/option_types.hh @@ -242,17 +242,19 @@ enum class DebugFlags Hooks = 1 << 0, Shell = 1 << 1, Profile = 1 << 2, + Keys = 1 << 3, }; template<> struct WithBitOps : std::true_type {}; -constexpr Array, 3> enum_desc(DebugFlags) +constexpr Array, 4> enum_desc(DebugFlags) { return { { { DebugFlags::Hooks, "hooks" }, { DebugFlags::Shell, "shell" }, - { DebugFlags::Profile, "profile" } + { DebugFlags::Profile, "profile" }, + { DebugFlags::Keys, "keys" } } }; }