Fix keyboard layout handling on X11

This commit is contained in:
Victor Tran 2023-10-17 22:45:46 +11:00
parent d2a00cc608
commit 4be1056a7a
No known key found for this signature in database

View file

@ -206,18 +206,18 @@ void X11Backend::loadKeyboardLayouts() {
}
void X11Backend::updateKeyboardLayout() {
// QProcess xkbmapProcess;
// xkbmapProcess.start("setxkbmap", {"-query"});
// xkbmapProcess.waitForFinished();
QProcess xkbmapProcess;
xkbmapProcess.start("setxkbmap", {"-query"});
xkbmapProcess.waitForFinished();
// while (xkbmapProcess.canReadLine()) {
// QString line = xkbmapProcess.readLine().trimmed();
// if (line.startsWith("layout:")) {
// QString layout = line.split(" ", Qt::SkipEmptyParts).at(1);
// d->currentLayout = layout;
// return;
// }
// }
while (xkbmapProcess.canReadLine()) {
QString line = xkbmapProcess.readLine().trimmed();
if (line.startsWith("layout:")) {
QString layout = line.split(" ", Qt::SkipEmptyParts).at(1);
d->currentLayout = layout;
return;
}
}
}
bool X11Backend::nativeEventFilter(const QByteArray& eventType, void* message, qintptr* result) {