Skip to content

Commit 6c50626

Browse files
committed
Fix for 'us' bookworm keyboard layout selection where the default already sets 'us' but also a model other than that attached
1 parent dd9987f commit 6c50626

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gemian_setup.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ int main() {
4646

4747
if (hwKeyboard.length() > 0) {
4848
auto found = false;
49+
auto foundModel = false;
4950
std::ifstream keyboardDefault(defaultKeyboardFile);
5051
if (keyboardDefault.is_open()) {
5152
while (!keyboardDefault.eof()) {
@@ -54,11 +55,14 @@ int main() {
5455
if (toCheck.find("XKBLAYOUT=") != std::string::npos && toCheck.find(hwKeyboard) != std::string::npos) {
5556
found = true;
5657
}
58+
if (toCheck.find("XKBMODEL=") != std::string::npos) {
59+
foundModel = true;
60+
}
5761
}
5862
} else {
5963
std::cout << "Failed to open file: " << defaultKeyboardFile << std::endl;
6064
}
61-
if (!found) {
65+
if (!found || foundModel) {
6266
auto setKeymap = "localectl set-x11-keymap " + hwKeyboard;
6367
auto err = system(setKeymap.c_str());
6468
std::cout << setKeymap << " : " << err << "\n";

0 commit comments

Comments
 (0)