lib/jquery_pnotify, lib/moment, lib/lodash, misc/notification, site/engine, misc/social
if( $.browser.msie && $.browser.version <= 8 ) include('lib/respond'); $._social.__cfg = {"init":[{"service":"basic"},{"fb_app_id":"1997094873850041","service":"fb"},{"vk_app_id":"2978320","service":"vk"},{"service":"twi"}],"like":[{"service":"fb"},{"service":"vk"},{"via":"","channel":"","hash_tag":"","service":"twi"}]}; window._SiteEngine = new classes.SiteEngine( { user_id: 0, controller: 'content_article', action: 'view', content_css_version: '1459538664', social_enabled: 0} );


Блог web-программиста

Custom English-German layout for Ubuntu

24 ноября 2019 18:00

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
	<description>English (DE, Zubashev Stepan's version with dead keys)</description>

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. 

Linux German
Оставить комментарий
Оставить комментарий:
Отправить через:
window._Comment_content_article_175 = new classes.Comment( '#comment_block_content_article_175', { type: 'content_article', node_id: '175', user: 1, user_id: 0, admin: 0, view_time: null, msg: { empty: 'Комментарий пуст', ask_link: 'Ссылка:', ask_img: 'Ссылка на изображение:' } });