From 25dd1b516614f2b956d21d0b3e266d720ccd7969 Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 3 Aug 2022 18:06:10 -0700 Subject: [PATCH] Language is now set on layer change --- src/main.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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(); }