LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to build a keyboard layout file form scrach? (https://www.linuxquestions.org/questions/linux-general-1/how-to-build-a-keyboard-layout-file-form-scrach-4175675144/)

Johannes33 05-13-2020 09:24 AM

how to build a keyboard layout file form scrach?
 
Hi.
I have been struggling to get a hold of a comprehensive guide how to build a keyboard layout for a couple of days now. I can not find any on the internet.

About xmodmap:
I do not want to use xmodmap. since trying to do so resulted in that my caps lock key were still preforming caps lock function after reassignment. do not know why. but it did not work. Also putting a standard file in /usr/share/X11/symbols seems better.

So does anyone know a comprehensive guide where I can get to know how to reassign function keys as well? Or a book for that matter. When looking in /usr/share/X11/symbols and search for i.e. us I find a lot of files. so US keyboard layouts seems to use a lot of files. I would like to understand how it works also there seems to be references to other files in the files if I'm not mistaken how does that work?

Two systems:
Also the keyboard file for console and X is different so is there an easy way to write one file and convert it to the format of the other?

Is there a program that shows which key I'm pressing i.e. like xev but for the syntax that is used in the keymap files in /usr/share/X11/symbols. i.e. <AC01> = a?

why I'm doing all this is because I want to use ARENSITO for my kinesis keyboard and have a arensito-kinesis.xkb file but do not know how to convert it into the syntax that is used by X or consol for that matter.

So If you have a suggestion about how to solve the problem by using the xkb file I would be all ears as well. >)

linux distro: KDE-neon (latest) basically kubuntu


Thanks for your help!

DavidMcCann 05-13-2020 11:15 AM

The file arensito-kinesis.xkb is ready to use, but it needs to be saved as /usr/share/X11/xkb/keycodes/evdev. First rename the existing file as evdev.bak — if anything goes wrong, you'll need it back! After saving the file, log out and in again and things should just work — if the file has no errors.

The console files are very different. The location varies, but you could try
/lib/kbd/keymaps/i386/
/usr/lib/kbd/keymaps/i386/
The file …qwerty/us.map.gz will show you what they should look like — obviously you are going to have to write the new file by hand. Note the include statements at the start — these files will also have to be altered.

Johannes33 05-13-2020 12:51 PM

Thanks a lot for the information!!
After I change it's name to evdev is it still possible to change key map in the settings in KDE or do I have to use evdev.bak to toggle between key maps?
Since you seem to know some things about keymaps, do you know how it works with function keys?
I read somewhere that above (I think it was F70) a certain number one can use they without collision. like 192.168 in networks. Do you know if it was F70 or if it was from F13 to F70?

Also do you know where I can read about the syntax of the normal key layout file, in my example it was named us.

DavidMcCann 05-14-2020 11:55 AM

The desktops are designed to enable you to switch languages, not hardware. If a keyboard is identified as a PC one when you boot the computer, then it will select evdev — otherwise one of the other files in keycodes/.

The system works by matching the hardware file in keycodes/ to one or more of the files in symbols/. So, on a PC the first key in the home row is 38, but on a Mac it's 8. Those codes are replaced by AC01 — alphanumeric area, row c (third up), first key. The language drivers in symbols/ then replace AC01 with the code for the appropriate letter — a in QWERTY or q in AZERTY. All the files are considered to be C source code — ence the final semicolons.

The approach that the website recommended rewrote the evdev file so that the English language file would work with it. The better approach would be to use that adopted for a Dvorak keyboard, which you can see in the file symbols/us, where you adapt the language file. If you want to switch keyboards, that would be the way to do it. Create a driver in symbols, with the keys in the right places. So the QWERTY driver has
key <AC02> { [ s, S ] };
and the Dvorak one has
key <AC02> { [ o, O ] };
and your system would need
key <AC02> { [ r, R ] };

Using that approach, you can stay with the original evdev file. The new section in the us file can be treated as a variant. The desktop won't know about it, so you may have to edit its configuration files manually. In my Xfce configuration, I have the line
<property name="XkbLayout" type="string" value="gb,astro,gr"/>
where I had to insert astro manually because it's my own invention.

I don't know how many function keys can be created, but the IBM mainframe terminals have 24.


All times are GMT -5. The time now is 03:07 PM.