[HOWTO] Non-latin shortcuts/hotkeys in linux (russian keyboard layout example)

[Update]

if you just need a fix for firefox russian shortcuts, go here: https://addons.mozilla.org/firefox/3529/

Если вы ищете патч/аддон для Firefox, то вам сюда: https://addons.mozilla.org/firefox/3529/ Спасибо за эту информацию max’у. Проверено – работает на отлично🙂

[/Update]

Ok, there is this VERY annoying thing in linux – in some applications keyboard shortcuts just don’t work. First of all – why? Ok, let’s take russian layout for example – the shortcut for “Paste” is [ctrl]+v, right? In russian layout it is [ctrl]+м, so the application just doesn’t get the command! And there is a workaround to fix it (BUT you will have to use an additional modifyer key to access shortcuts! (e.g. instead of [ctrl]+v you will need to press [ctrl]+[win]+v)).Basically, the idea of this workaround is very simple – use an additional modifyer, which will switch the keyboard layout to english while pressed, so that the shortcut will work. This is a two-step procedure.

How to setup this for russion keyboard layout:

1. (NB! There is an attached file, called “ru” – this is an updated version of the file, so feel free to download it and just replace your file) You have to edit/update the xkb file, that defines the russian layout. It is usually located in /etc/X11/xkb/symbols/ru (at least in Ubuntu). I am using Arch Linux – the location of this file is /usr/share/X11/xkb/symbols/ru. Open this file in your favourite text editor (you have to be superuser to edit this file, so do a sudo or just su) and find the following section:

xkb_symbols “basic” {

name[Group1]= “Russia”;

key <AE01> { [ 1, exclam ] };
……
key <AB10> { [ slash, question ] };
key <LSGT> { [ slash, bar ] };

key.type[group1]=”ALPHABETIC”;

key <TLDE> { [ Cyrillic_io, Cyrillic_IO ] };
key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI ] };
…….
key <AB09> { [ Cyrillic_yu, Cyrillic_YU ] };

key.type[group1]=”TWO_LEVEL”;

// End alphanumeric section
};

Ok, now replace the whole section (beginning with xkb_symbols “basic” and ending with };) with the following:

xkb_symbols “basic” {

name[Group1]= “Russia”;

key.type[group1]=”FOUR_LEVEL_ALPHABETIC”;

key <AE01> { [ 1, exclam, NoSymbol, NoSymbol ] };
key <AE02> { [ 2, quotedbl, NoSymbol, NoSymbol ] };
key <AE03> { [ 3, numbersign, NoSymbol, NoSymbol ] };
key <AE04> { [ 4, asterisk, NoSymbol, NoSymbol ] };
key <AE05> { [ 5, colon, NoSymbol, NoSymbol ] };
key <AE06> { [ 6, comma, NoSymbol, NoSymbol ] };
key <AE07> { [ 7, period, NoSymbol, NoSymbol ] };
key <AE08> { [ 8, semicolon, NoSymbol, NoSymbol ] };
key <AE09> { [ 9, parenleft, NoSymbol, NoSymbol ] };
key <AE10> { [ 0, parenright, NoSymbol, NoSymbol ] };
key <AE11> { [ minus, underscore, NoSymbol, NoSymbol ] };
key <AE12> { [ equal, plus, NoSymbol, NoSymbol ] };
key <BKSL> { [ backslash, bar, NoSymbol, NoSymbol ] };
key <AB10> { [ slash, question, NoSymbol, NoSymbol ] };
key <LSGT> { [ slash, bar, NoSymbol, NoSymbol ] };

key.type[group1]=”FOUR_LEVEL_ALPHABETIC”;

key <TLDE> { [ Cyrillic_io, Cyrillic_IO, NoSymbol, NoSymbol ] };
key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI, q, Q ] };
key <AD02> { [ Cyrillic_tse, Cyrillic_TSE, w, W ] };
key <AD03> { [ Cyrillic_u, Cyrillic_U, e, E ] };
key <AD04> { [ Cyrillic_ka, Cyrillic_KA, r, R ] };
key <AD05> { [ Cyrillic_ie, Cyrillic_IE, t, T ] };
key <AD06> { [ Cyrillic_en, Cyrillic_EN, y, Y ] };
key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE, u, U ] };
key <AD08> { [ Cyrillic_sha, Cyrillic_SHA, i, I ] };
key <AD09> { [ Cyrillic_shcha, Cyrillic_SHCHA, o, O ] };
key <AD10> { [ Cyrillic_ze, Cyrillic_ZE, p, P ] };
key <AD11> { [ Cyrillic_ha, Cyrillic_HA, NoSymbol, NoSymbol ] };
key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN, NoSymbol, NoSymbol ] };
key <AC01> { [ Cyrillic_ef, Cyrillic_EF, a, A ] };
key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU, s, S ] };
key <AC03> { [ Cyrillic_ve, Cyrillic_VE, d, D ] };
key <AC04> { [ Cyrillic_a, Cyrillic_A, f, F ] };
key <AC05> { [ Cyrillic_pe, Cyrillic_PE, g, G ] };
key <AC06> { [ Cyrillic_er, Cyrillic_ER, h, H ] };
key <AC07> { [ Cyrillic_o, Cyrillic_O, j, J ] };
key <AC08> { [ Cyrillic_el, Cyrillic_EL, k, K ] };
key <AC09> { [ Cyrillic_de, Cyrillic_DE, l, L ] };
key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE, NoSymbol, NoSymbol ] };
key <AC11> { [ Cyrillic_e, Cyrillic_E, NoSymbol, NoSymbol ] };
key <AB01> { [ Cyrillic_ya, Cyrillic_YA, z, Z ] };
key <AB02> { [ Cyrillic_che, Cyrillic_CHE, x, X ] };
key <AB03> { [ Cyrillic_es, Cyrillic_ES, c, C ] };
key <AB04> { [ Cyrillic_em, Cyrillic_EM, v, V ] };
key <AB05> { [ Cyrillic_i, Cyrillic_I, b, B ] };
key <AB06> { [ Cyrillic_te, Cyrillic_TE, n, N ] };
key <AB07> { [Cyrillic_softsign,Cyrillic_SOFTSIGN, m, M ] };
key <AB08> { [ Cyrillic_be, Cyrillic_BE, NoSymbol, NoSymbol ] };
key <AB09> { [ Cyrillic_yu, Cyrillic_YU, NoSymbol, NoSymbol ] };

key.type[group1]=”FOUR_LEVEL_ALPHABETIC”;

// End alphanumeric section
};

2. Ok! One step more and we’re done. Now you need to add a third-level chooser in your xkb. If you are using KDE, then go to Control Center -> Regional & Accessibility -> Keyboard Layout -> Xkb Options. Check Enable xkb options if it is not checked and the Third level choosers section in the list, check the options you want and click Apply (I chose Press any of Win-keys to choose 3rd level). That should be it. You done! To test the thing open up Firefox, switch to russian layout and press [ctrl]+[win]+c to Copy and then [ctrl]+[win]+v to Paste.

I hope that this entry will be helpful to (at least) some people with non-latin layouts.

Updated “ru” file!

(Right-click the link, choose to save the file and remove the extension ;))

10 Responses to [HOWTO] Non-latin shortcuts/hotkeys in linux (russian keyboard layout example)

  1. У меня например
    > смена раскладок left Shift + left ALT
    > и left WinKey while pressed
    Т.е при русской раскладке нажать ctrl+winkey+c и всё будет copy
    Тока настройки, это всего две галочки в keyboard indicator applet😐
    Или в Арче Gnome/KDE кастрированый😀 ??

  2. я пытался так сделать, однако не получилось (не знаю почему, может надо было rmmod кривые_руки?), поэтому пришлось поизвращаться🙂

  3. Igor says:

    Так это костыль GTK приложений (например, в Kate такого нет). Его пофиксили в firefox каким-то патчем.

  4. Crocodile2u says:

    Оченно полезный хауту – без него я использовал оперу в качестве браузера, теперь можно в принципе перейти на ФФ🙂. Конечно, ктрл+вынь+ц это не так удобно, как просто ктрл+ц… но все же гораздо лучше, чем постоянно переключаться между раскладками…

  5. max says:

    JFYI: вот патч для ФФ, о котором шла речь выше https://addons.mozilla.org/firefox/3529/

  6. Michael Lashkevich says:

    It means that, up to now, there is nothing better than “xruskb”, where there is no such problem with hot keys. The only problem of “xruskb” is that it needs to be restarted from time to time, because it loses control over the X keyboard once upon a time (starts to only type latin characters).

  7. OlegVasylief says:

    Как здорово что все мы здесь сегодня собрались

  8. dosokiob says:

    Ваше объявление в сети интернет , предлагаем Вам разместить Вашу рекламу на 7700 электронных досок объявлений России и Украины за 14 долларов или 14 wmz Skype:wwweeebbbmaster,
    тел. +38-097-9453432 e-mail: 7777dosok@gmail.com

  9. dosokiob says:

    Ваша Реклама в интернете , услуги по размещению Вашего объявления на 7500 электронных досок объявлений России и Украины за 14 долларов или 14 wmz Skype:wwweeebbbmaster,
    тел. +38-0979453432 e-mail: 7777dosok@gmail.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: