diff --git a/src/main.cpp b/src/main.cpp index dd2b7b7..b825573 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -352,6 +352,8 @@ int main(int argc, char *argv[]) { // Write buffer uint8_t hid_buf[Dox.packet_size]; + uint8_t last_layer_layout; + Dox.connect_loop(); @@ -369,7 +371,6 @@ int main(int argc, char *argv[]) { struct mpd_connection *conn = mpd_connection_new(NULL, 0, 0); while (1) { - memset(hid_buf, 0, sizeof(uint8_t) * Dox.packet_size); if (Dox.is_connected()) { @@ -446,6 +447,23 @@ int main(int argc, char *argv[]) { } } + if ( + (last_layer_layout != Dox.get_layer_layout()) && + (Dox.get_layer_layout() != LAYOUT_NULL) + ) { + + last_layer_layout = Dox.get_layer_layout(); + + switch(last_layer_layout) { + case (LAYOUT_EN): + std::system("awesome-client \"modules.ibus.set('en')\""); + break; + case (LAYOUT_RU): + std::system("awesome-client \"modules.ibus.set('ru')\""); + break; + } + } + } else { Dox.connect_loop(); }