Changing non-printing keys in keyboard layout
Hi all, I'm trying to write a new keyboard layout. I'm testing using Debian Squeeze and Kubuntu 11.04, both with KDE. It is important to solve this issue with a keyboard layout as opposed to playing with xmodmap or scancodes and keycodes because I need to leave other keyboard layouts intact and usable. For the time being the new layout is called Noah, implemented as a variant of US English. If this is done more easily by making whole new layout that is not a variant of another then I am willing to go that route.
First off, I am trying to move the Caps Lock key to the current location of the "B" Key. This is my code (the unshown parts of the files have not been touched): Code:
✈demios:~$ tail /usr/share/X11/xkb/symbols/us -n 68 Code:
✈demios:~$ tail /usr/share/X11/xkb/symbols/pc -n 4 Here is the homepage of the Noah layout: http://dotancohen.com/eng/noah_ergon...rd_layout.html Thanks! |
The file /usr/share/X11/xkb/symbols/pc will affect everything, because it is included when compiling all layouts. Leave it to show
modifier_map Lock { Caps_Lock, ISO_Lock }; The key <AB05> will be translated to Caps_Lock by key <AB05> { [ Backspace, Caps_Lock ] }; All the line in the other file does is to define what Caps_Lock does. |
Thanks, David. However, I need to place the "A" key in Noah where the current Caps Lock is, so how can I make the Lock key stop being Caps_Lock when the Noah layout is in use?
As it stands, when I press "A" in the Noah layout it activates the letter "A" _and_ Caps_Lock. Noah "A" is on the QWERTY Caps_Lock key. |
The problem here is that <CAPS> is being defined as Caps_Lock by the file …/symbols/pc and also by …/symbols/capslock.
You need to start again with a different approach by editing /usr/share/X11/xkb/keycodes/evdev Replace <CAPS> = 66; <AB05> = 56; with <AC00> = 66; <CAPS> = 56; Then all the references to <CAPS> in the original symbols files can be left alone and you will only need to set key <AC00> { [ a, A ] }; |
Thanks, David, but that would prevent Caps_Lock from working properly in the standard US English QWERTY variant!
Could I make a new file /usr/share/X11/xkb/keycodes/evdev-noah which would have the proper code set like this: <AC00> = 66; <CAPS> = 56; And then in the Noah variant I would use the evdev-noah file instead of evdev? How would I call the evdev-noah file then? If this is not possible, then could it be done if Noah were a different layout, as opposed to being a US English variant? Thanks. |
I didn't realise that you were still using the standard layout as well. In that case you will have to keep the evdev file untouched and create a separate symbols file noah. You can incorporate the contents of the pc and capslock files into that, replacing all references to CAPS with AB05.
If that doesn't work, then something will have been calling the pc or capslock files. The command setxkbmap -print will show all the material used to create the drivers, so you can check the types and compat files listed, and the ones they call. Your keyboard installer will probably list available keyboards by language and country, so "noah" will not appear. You can add it manually: on my Fedora computer it's in ~/.gconf/desktop/gnome/peripherals/keyboard/kbd/%gconf.xml where I have the special keyboard astro enabled: <entry name="layouts" mtime="1298041593" type="list" ltype="string"> <li type="string"> <stringvalue>gb</stringvalue> </li> <li type="string"> <stringvalue>gr</stringvalue> </li> <li type="string"> <stringvalue>astro</stringvalue> </li> </entry> |
Thanks, David, I just spend a few hours tracking things down through "setxkbmap -print". That was a great tip, I cannot thank you enough!
It seems that I could simply reassign keycodes from aliases in /usr/share/X11/xkb/keycodes/evdev like you suggested earlier, but instead of saving them to that file I would save them to a new file, say, /usr/share/X11/xkb/keycodes/evdev-noah. But how do I call that file from the Noah layout? What does the word "evdev" stand for, this might be hint! I'm not really sure how things get called, and so I'm stuck. If I create a new layout (not a variant as I have been doing) then I make a new file /usr/share/X11/xkb/symbols/noah using /usr/share/X11/xkb/symbols/us as a template: Code:
default There are tons of resources online for creating custom layouts, but nothing addresses the modifier keys or Caps. I'm pretty certain if we can swap Caps_Lock and B then I can figure the rest out. Your help is cordially appreciated. |
I think I've reached my limits here too! On my keyboard, the old Caps is now Third level shift, old Scroll lock is Group shift, and old Pause is Caps, but this applied to all my keyboard drivers, so I don't have your problem.
The markup in these tables is very obscure. Sections can include references to modifiers without being marked as doing so (and vice versa!) and "partial" is a bit of a mystery too. The whole process starts when the computer finds a PC (as opposed to Mac or Sun) keyboard and takes evdev for the list of keycodes (unless the distro prefers xfree86). In other words, by the time you log in and it sees what drivers you want, it's too late to change. That's why you can only have one version of evdev. |
Quote:
Quote:
Quote:
Quote:
Thanks! |
The treasure trove these old threads are
10 years later is a long time. However, when looking for any solution for the puzzle of trying to map Caps Lock to a normal key, this discussion was the only guiding light I've found. And what a help it was! So I want to thank both dotancohen and DavidMcCann for their help.
Since what I wanted was to make the Caps key to behave as a level 1 key, DavidMcCann showed me the way in this thread's #4 post. It's as simple as he describes there. You just assign the Caps keycode to a new label (AC00, for example, as he suggested), and change the CAPS keycode to another key, existing or not. In my case, I pointed the CAPS label to the keycode of a special key I never use on my keyboard. I then created that new AC00 label with the Caps key actual keycode. Then, on my layout file, I defined what characters I wanted printed upon using that AC00 key. Then I saved the file, restarted my X session and, voilá, the magic happened. So if anyone is looking for something similar, you have to look no further than to this thread. And if both participants are still out there and come across my post, thank you so much for your help. It's exchanges like this that make the internet such a wonderful tool. |
Thank you! It's always nice to think that old posts are still doing their job. That's what makes a forum a great place, as opposed to something like a mailing list or (worse) reddit.
|
All times are GMT -5. The time now is 05:34 PM. |