Language is now set on layer change
parent
30422df0da
commit
25dd1b5166
20
src/main.cpp
20
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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue