Bash ’em all to hell!

November 27, 2006

I love grep, find, locate & whereis! They’re awesome! Supa-dupa-pupa-miracles! Jeez, how did I live without them before?..

Advertisements

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

November 15, 2006

[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 ;))