You are not logged in.
Hello everyone!
I followed the instructions from the Wiki, trying to get Caps Lock to act like an Escape button (https://wiki.archlinux.org/index.php/Li … r_examples), and in particular, I created a file called "personal.map" which contained:
keycode 1 = Caps_Lock
keycode 58 = Escape
and then I loaded it with sudo loadkeys personal.map
However, it didn't produce the desired result, and the behavior of the Caps Lock key is rather strange after the change: a regular keystroke does nothing, but combining it with Shift, Alt or Control does work like an Escape button. In vconsole.conf the KEYMAP parameter is set to the default us. The keycodes are correct, I checked that with the showkey command. I also investigated a little bit more and found out that any interference with how Caps Lock operates in tty (be it with the loadkeys utility or through directly modifying the us.map.gz file) leads to it only working when pressed with any of the three aforementioned keys.
How do I fix this? Should I provide any additional information?
Last edited by dying_fetus (2020-04-20 16:54:41)
Offline
Worksforme™
How exactly did you test the escape behavior? (Which program/s did you use as testcase)
Does it work in ncurses? (Eg. dialogs in mc)
Does the key still produce a signal in showkey after the custom map is loaded (w/o the modifiers being pressed)
Offline
Worksforme™
How exactly did you test the escape behavior? (Which program/s did you use as testcase)
Does it work in ncurses? (Eg. dialogs in mc)
Does the key still produce a signal in showkey after the custom map is loaded (w/o the modifiers being pressed)
1. Exiting the insert mode in vim. Also the console cursor flickers a little when you press the Esc key, that is another way I could tell lol.
2. I've checked it with ncurses (wifi-menu in particular), same negative result: only works with a modifier.
3. Yes, the command outputs the expected "keycode 58"
I can't deny that you are right, that is one way it can work. Yet on the other hand, it ruins the entire comfy vim experience, now, does it not? ![]()
Last edited by dying_fetus (2020-04-20 15:08:18)
Offline
No flicker, no nothing. Works w/ vim as expected.
What's your base layout (before you load personal.map - us, de, …)?
Offline
No flicker, no nothing. Works w/ vim as expected.
What's your base layout (before you load personal.map - us, de, …)?
It was "us", but I kept tinkering and investigating until I encountered even more bizarre behavior:
I replaced "keycode 58 = Caps_Lock" with "keycode 58 = Escape" in the file "ru.map.gz" (which contains two layouts, for English and Russian, with the ability to switch between the two); saved it as "esc.map.gz" and set as my default layout in /etc/vconcole.conf. Upon rebooting I was greeted with this unexpected outcome: when I am in the "English mode", Caps Lock functions as it did before, only producing "Escape" when pressed together with a modifier, BUT if I toggle the layout to Russian, it actually does what it is supposed to, acts like a normal Escape button! Given that there is only one mention of the keycode number 58 in the entire keymap, the one I edited, I am lost for words at how puzzling this is...
Last edited by dying_fetus (2020-04-20 20:00:32)
Offline
Try "KEYMAP=de" in vconsole.conf (it's much more like us, but a qwertz layout), then "loadkeys personal.map" and check the behavior. Then "loadkeys us", check the behavior and "loadkeys personal.map" and check the behavior again.
The us map doesn't define the escape key for modified versions, ru (shift/altgr) and de (shift) do …
Offline
Try "KEYMAP=de" in vconsole.conf (it's much more like us, but a qwertz layout), then "loadkeys personal.map" and check the behavior. Then "loadkeys us", check the behavior and "loadkeys personal.map" and check the behavior again.
The us map doesn't define the escape key for modified versions, ru (shift/altgr) and de (shift) do …
Followed your instruction, this is what I observed:
1. KEYMAP=de + loadkeys personal.map:
Caps Lock does not work, Escape acts as Caps Lock and as Escape when pressed with either Shift or Alt
2. loadkeys us
The behavior of Caps Lock does not change, Escape is back to its normal behavior
3. loadkeys us + loadkeys personal.map
Caps Lock does not work, Escape acts as Caps Lock and as Escape when pressed with either Shift or Alt (exactly the same as with KEYMAP=de + loadkeys personal.map)
Last edited by dying_fetus (2020-04-21 08:59:42)
Offline
"Does not work" meaning "by itself" or not even in the modified variant?
Could this be some HW related issue? I assume you used Ctrl+Shift to toggle between us and ru, is it maybe rather the combo and less the action that impacted the behavior?
Offline
"Does not work" meaning "by itself" or not even in the modified variant?
Could this be some HW related issue? I assume you used Ctrl+Shift to toggle between us and ru, is it maybe rather the combo and less the action that impacted the behavior?
Doesn't work without modifiers, and I use right alt to toggle between the languages.
Moreover, since showkey still returns the right keycode I don't see how it could be HW related; something else, other than kbd loadkeys must be interfering as the keyboard works perfectly in X with "setxkbmap -option 'caps:escape_shifted_capslock'" and malfunctions in tty. I wish there was some way I could investigate further but I lack the knowledge.
Offline