9

I am trying to create a linux equivalent of Ergonomic Telugu Keyboard layout called Sarala (Hard la). I have been able to map all the keys so far. The layout uses the following key combinations for various levels.

None (Base): Level1
Shift: Level2
Ctrl + Alt: Level3
Ctrl + Alt + Shift:Level4

Where as linux uses the following for various levels.

None (Base): Level1
Shift: Level2
RAlt: Level3
RAlt + Shift:Level4

To be able to match the key combinations with my layout, I would have to map AltGr with a Ctrl + Alt. I have unsuccessfully searched though various files in /usr/share/X11/xkb/. Does any body know how I can bind the ISO_Level3_Shift with Ctrl + Alt ?

key <RALT>  {
    symbols[Group1]= [ Mode_switch, Multi_key  ],
    virtualMods= AltGr
};

If you want to look at the layout, it's here

migrated from askubuntu.com Sep 26 '14 at 23:16

This question came from our site for Ubuntu users and developers.

  • 2
    have a look here askubuntu.com/questions/254424/… – αғsнιη Sep 17 '14 at 16:54
  • 2
    Thankyou, that is very informative but it talks about everything else except xkb configuration. – ShaggyInjun Sep 17 '14 at 19:05
  • You can look through this wiki from arch linux wiki, and check out the part about Alt and Altgr (Level 3). I am not sure if this will help you, but it seems to have a lot of information about XKB – No Time Sep 22 '14 at 16:56
  • I have tried that, xkb fails to load with a not so descriptive error. I don't have the error handy, but I can attach it later. – ShaggyInjun Sep 22 '14 at 17:46
3

You need to define a new xkb type. You can see examples in your xkb/types directory (usually /usr/share/X11/xkb/types). There you can define arbitrary combinations of modifiers to get different levels of shifting. For your problem, you can use something like this:

type "C_A_to_L3" {
    modifiers = Control+Alt+Shift;
    map[None] = Level1;
    map[Shift] = Level2;
    map[Control+Alt] = Level3;
    map[Control+Alt+Shift] = Level4;
    level_name[Level1] = "Base";
    level_name[Level2] = "Shift";
    level_name[Level3] = "Alt Base";
    level_name[Level4] = "Shift Alt";
};

Then in your symbols file you can set that type as the default, or set on a per-key basis what type it is. Note that you need the type to be in a file in the types directory, and the key definition in a file in the symbols directory -- xkb uses a strict filesystem hierarchy to find each component.

I've done a fair bit of hacking on keyboard layouts myself to build my custom layout (https://github.com/willghatch/hatchak), which has gone through various iterations where I've experimented with weird things. XKB can be pretty finnicky and strange at times, but it is still the most configurable keyboard system I've seen by far. The best references if you have more troubles are:

http://www.charvolant.org/~doug/xkb/html/index.html

and

http://pascal.tsu.ru/en/xkb/

Beware -- while that's the best documentation I've found, it leaves plenty of murky edge cases. Good luck.

  • I think your idea is really useful, but I'm really struggling to use the created type in the symbol files as default as you mentioned. The symbol files I have on my computer are quite long and I don't see any line that looks like a definition of a default type. – Dave Jul 3 '16 at 17:57
  • 1
    You can define a default for a section within a symbols file by setting key.type. You can probably see an example at /usr/share/X11/xkb/symbols/srvr_ctrl (or somewhere like that), in the "no_srvr_keys" section. Here is what I have: xkb_symbols "no_srvr_keys" { key.type="TWO_LEVEL"; key <FK01> { [ F1, F1 ] }; key <FK02> { [ F2, F2 ] }; <etc...> }; – William Hatch Jul 5 '16 at 16:01
  • Thanks for the quick answer. I think I will be able to apply that. Thanks a lot in advance. – Dave Jul 7 '16 at 11:53
  • Just as a feedback for all those coming to this page back even a long time later. For me this approach worked now with a newly installed Fedora. For some (to me) unknown reason it did not work with Mint when I wrote that comment above. But now it works and saves me a lot of time. – Dave Jan 20 '17 at 22:08
0

From what I've seem you need a keyboard layout that support AltGr, so you can simply change the hotkey at "keyboard > shortcuts > alternative characters key" in the the config menu. Normally you can see it by changing into a layout that "has dead keys" or is written "AltGr dead keys"

  • I am not asking for personal use, I need to ship the layout. Unfortunately this is a bad answer. Thankyou however. – ShaggyInjun Sep 23 '14 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.