German language contains some extra latin symbols that English language doesn’t: ä, ö, ü, ß
. But if you choose German keyboard layout instead of English you get some keyboard keys moved to unusual positions. If it’s okay for you then you don’t need to do anything with it. Just get used to the new layout! But if you wanna stay with the English version of latin keys positions you need to find some convenient way to type German specific letters.
Compose Key
The first solution that you can use ― compose-key
. Usually people set it to scroll lock
key. By pressing it with some extra keys (e.g. scroll-lock and " and o
gives you ö
) you can write lots of non-latic symbols. It solves the problem but it’s still too long and an inconvenient approach.
International layout with “dead keys”
You can also choose predefined preinstalled “International layout with dead keys
”. Just set it in the Keyboard preferences
. It works much more handy. You press altGr + p
(right alt) and get ö
. Wow. It’s much faster. But… why P? why don’t use just o for ö? u for ü? a for ä? s for ß? It’s because of the fact that there are many variants for a-like symbols, not only ä. It lead us to the final solution:
Write your own layout
… that includes only those symbols that you want. So open as a project /usr/share/X11/xkb
directory. In symbols
-subdirectory you can find "us"
file. It contains all the layouts for United States
. Inside of this file you will find the layout from the previous section. Just type in the search input: altgr-intl
. There’s some explanation of this file’s format. Finally I´ve got this:
partial alphanumeric_keys xkb_symbols "your-layout-name" { include "us(basic)" name[Group1]= "Your layout description"; key <AC01> { [ a, A, adiaeresis, Adiaeresis ] }; key <AC02> { [ s, S, ssharp, section ] }; key <AD07> { [ u, U, udiaeresis, Udiaeresis ] }; key <AD09> { [ o, O, odiaeresis, Odiaeresis ] }; key <AE05> { [ 5, percent, EuroSign, dead_cedilla ] }; key <AB03> { [ c, C, copyright, cent ] }; include "level3(ralt_switch)" };
This partial does next:
- map
altGr + a
toä
- map
altGr + s
toß
- map
altGr + u
toü
- map
altGr + o
toö
It’s based on us(basic)
layout (i.e. the standard US English layout). It uses level3(ralt_switch)
“mixin” that add altGr
meta-support there.
But this is not enough. We need to somehow register it in the kkb
system. I dunno how to do it properly so I just looked at how it was done for altgr-intl
and did the same. I have altered base.lst
, base.xml
, evdev.lst
& evdev.xml
files:
// added below code in .lst files your-layout-name us: your layout description
added below code in .xml files
<variant> <configItem> <name>your-layout-name</name> <description>English (DE, Zubashev Stepan's version with dead keys)</description> <languageList> <iso639Id>eng</iso639Id> <iso639Id>ger</iso639Id> </languageList> </configItem> </variant>
Look thoroughly at <languageList/>
. You need to assign there those languages that should be influenced. Otherwise I don’t know how you will find later your new layout.
Then I´ve run sudo dpkg-reconfigure xkb-data
and restarted Keyboard Preferences
. My new layout was there. And it even worked. With a very strange behaviour. So later I restart the whole system and things went even worse. I’ve run again sudo dpkg-reconfigure xkb-data
and again restarted the system. Now it looks like it works well ;)
So if you wanna do something like this ― good luck!
P.S. formats of these files may differ from system to system.