summaryrefslogtreecommitdiffstats
path: root/xlnch.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlnch.c')
-rw-r--r--xlnch.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/xlnch.c b/xlnch.c
index a5ffd62..f39f606 100644
--- a/xlnch.c
+++ b/xlnch.c
@@ -302,11 +302,16 @@ int run()
return 0;
}
- XLookupString(&event.xkey, text, 255, &keysym, 0);
- flag = 0;
-
for (unsigned int i = 0; i < idx; i++) {
- if (lnch[i].key == text[0]) {
+ char tmp[128] = "";
+ // get configured key
+ tmp[0] = lnch[i].key;
+ tmp[1] = '\0';
+ // convert to keysym, and then to keycode Keycodes are consistent
+ // across layouts but may vary between different keyboard models.
+ // For example, the keycode for the "A" key might differ between
+ // a US QWERTY keyboard and a French AZERTY keyboard.
+ if (XKeysymToKeycode(display, XStringToKeysym(tmp)) == event.xkey.keycode) {
rc = run_cmd(lnch[i].cmd);
flag = 1;
if (lnch[i].exits) {