resolve #8 Implement support of binding_event

This commit is contained in:
Sergey Naumov
2016-09-04 17:46:37 +03:00
parent c77c5af006
commit 42e4d05b75
3 changed files with 94 additions and 1 deletions

View File

@@ -5,7 +5,7 @@
int main() {
i3ipc::connection conn;
conn.subscribe(i3ipc::ET_WORKSPACE | i3ipc::ET_WINDOW);
conn.subscribe(i3ipc::ET_WORKSPACE | i3ipc::ET_WINDOW | i3ipc::ET_BINDING);
conn.signal_workspace_event.connect([](const i3ipc::workspace_event_t& ev) {
std::cout << "workspace_event: " << (char)ev.type << std::endl;
@@ -13,6 +13,17 @@ int main() {
conn.signal_window_event.connect([](const i3ipc::window_event_t& ev) {
std::cout << "window_event: " << (char)ev.type << std::endl;
});
conn.signal_binding_event.connect([](const i3ipc::binding_t& b) {
std::cout << "binding_event:" << std::endl
<< "\tcommand = \"" << b.command << '"' << std::endl
<< "\tinput_code = " << b.input_code << std::endl
<< "\tsymbol = " << b.symbol << std::endl
<< "\tinput_type = " << static_cast<char>(b.input_type) << std::endl
<< "\tevent_state_mask =" << std::endl;
for (const std::string& s : b.event_state_mask) {
std::cout << "\t\t\"" << s << '"' << std::endl;
}
});
// Don't forget this:
conn.prepare_to_event_handling();