*

Offline xasop

  • Administrator
  • *****
  • Posts: 7802
  • Professional computer somebody
    • View Profile
Custom keyboard layouts in X11
« on: April 03, 2021, 12:53:52 AM »
As a student of the Irish language, I wanted a way to enter a sineadh fada without using the XCompose method that has served me so well up to this point. The reasons are efficiency and accuracy: XCompose requires three keystrokes to input é, as opposed to two for a keyboard layout with AltGr+e; and this has the knock-on effect of making mistakes commonplace, such as pressing the keys in the wrong order and getting *iománáiocht instead of iománaíocht.

Unfortunately, the standard Irish keyboard layout is based on the terminally crippled UK layout, which means that it has (among other things) @, ", #, ~ and a few other symbols in the wrong places. Therefore, I took it upon myself to learn how to write my own xkb symbols file to create an ANSI-based Irish keyboard layout.

This turned out to be quite straightforward. The main annoyance is that if you make a mistake, X gives you no information whatsoever except that your symbols file has a mistake somewhere in it. But with a little trial and error, it's easy to get something that works well.

And so, behold! My new keyboard layout. I simply inherited the us(basic) layout I was already using (I don't want any of my existing usage to change), and added some new characters as combinations with AltGr. Each key has four symbols associated with it, corresponding to the key on its own, with Shift, with AltGr and with AltGr+Shift, respectively. NoSymbol means not to change the existing behaviour, which is why I used it everywhere that AltGr is not involved.

Code: [Select]
xkb_symbols "basic" {
    include "us(basic)"

    name[Group1]= "Irish (ANSI)";

    // Euro on 5 key
    key <AE05> { [ NoSymbol, NoSymbol,  EuroSign,       cent ] };

    // Q row
    key <AD03> { [ NoSymbol, NoSymbol,    eacute,     Eacute ] };
    key <AD04> { [ NoSymbol, NoSymbol, 0x100027C,   NoSymbol ] };
                                       // long r
    key <AD05> { [ NoSymbol, NoSymbol, tabovedot,  Tabovedot ] };
    key <AD07> { [ NoSymbol, NoSymbol,    uacute,     Uacute ] };
    key <AD08> { [ NoSymbol, NoSymbol,    iacute,     Iacute ] };
    key <AD09> { [ NoSymbol, NoSymbol,    oacute,     Oacute ] };
    key <AD10> { [ NoSymbol, NoSymbol, pabovedot,  Pabovedot ] };

    // A row
    key <AC01> { [ NoSymbol, NoSymbol,    aacute,     Aacute ] };
    key <AC02> { [ NoSymbol, NoSymbol, sabovedot,  Sabovedot ] };
    key <AC03> { [ NoSymbol, NoSymbol, dabovedot,  Dabovedot ] };
    key <AC04> { [ NoSymbol, NoSymbol, fabovedot,  Fabovedot ] };
    key <AC05> { [ NoSymbol, NoSymbol, gabovedot,  Gabovedot ] };

    // Z row
    key <AB01> { [ NoSymbol, NoSymbol, 0x100017F,  0x1001E9B ] };
                                       // long s, long s dot
    key <AB03> { [ NoSymbol, NoSymbol, cabovedot,  Cabovedot ] };
    key <AB05> { [ NoSymbol, NoSymbol, babovedot,  Babovedot ] };
    key <AB07> { [ NoSymbol, NoSymbol, mabovedot,  Mabovedot ] };

    include "level3(ralt_switch)"
};
« Last Edit: April 03, 2021, 01:26:35 AM by la xasop »
when you try to mock anyone while also running the flat earth society. Lol

*

Offline Toddler Thork

  • *
  • Posts: 4520
  • https://onlyfans.com/thork
    • View Profile
Re: Custom keyboard layouts in X11
« Reply #1 on: April 03, 2021, 08:59:51 AM »
Use a text expandor and it will auto correct to add all the silly accents for you. Also, 100% of Irish people speak English. Most don't speak Irish very well. You are wasting your life. You could be learning Japanese or Korean or something instead.
Rate this post.      👍 6     👎 1

*

Offline xasop

  • Administrator
  • *****
  • Posts: 7802
  • Professional computer somebody
    • View Profile
Re: Custom keyboard layouts in X11
« Reply #2 on: April 03, 2021, 10:16:36 AM »
Use a text expandor and it will auto correct to add all the silly accents for you.

No.

Also, 100% of Irish people speak English. Most don't speak Irish very well. You are wasting your life. You could be learning Japanese or Korean or something instead.

Coming from an Englishman, this is particularly rich.
when you try to mock anyone while also running the flat earth society. Lol

*

Offline Rama Set

  • *
  • Posts: 8378
  • Round and round...
    • View Profile
Re: Custom keyboard layouts in X11
« Reply #3 on: April 03, 2021, 10:19:43 AM »
Use a text expandor and it will auto correct to add all the silly accents for you.

No.

Also, 100% of Irish people speak English. Most don't speak Irish very well. You are wasting your life. You could be learning Japanese or Korean or something instead.

Coming from an Englishman, this is particularly rich.

Thork set a president for this kind of thing.
Th*rk is the worst person on this website.

*

Offline xasop

  • Administrator
  • *****
  • Posts: 7802
  • Professional computer somebody
    • View Profile
Re: Custom keyboard layouts in X11
« Reply #4 on: April 04, 2021, 10:09:04 PM »
I made a futhorc keyboard layout! This one does not inherit from any existing layout since its only purpose is to type Old English using runes, which didn't tend to use punctuation, although I did include numbers because they seem kind of useful. The layout is based on phonetic correspondence (or similarity) to QWERTY, but I relegated the pseudo-runes, īor, cweorð and stan, to the punctuation keys to the right where they can go mostly untouched. Cealc, being just a variant of calc which is not really necessary, is typed as Shift+calc.

With this layout, I can now say that ᚦᚩᚱᛣ ᛁᛋ ᚪᛏᚩᛚ.

Code: [Select]
xkb_symbols "basic" {
    name[Group1]= "Old English (Futhorc)";

    key <AE01> { [ 1 ] };
    key <AE02> { [ 2 ] };
    key <AE03> { [ 3 ] };
    key <AE04> { [ 4 ] };
    key <AE05> { [ 5 ] };
    key <AE06> { [ 6 ] };
    key <AE07> { [ 7 ] };
    key <AE08> { [ 8 ] };
    key <AE09> { [ 9 ] };
    key <AE10> { [ 0 ] };

    key <AD01> { [ U16C7 ] }; // eoh
    key <AD02> { [ U16B9 ] }; // wynn
    key <AD03> { [ U16D6 ] }; // ehwaz
    key <AD04> { [ U16B1 ] }; // rad
    key <AD05> { [ U16CF ] }; // tiwaz
    key <AD06> { [ U16A3 ] }; // yr
    key <AD07> { [ U16A2 ] }; // ur
    key <AD08> { [ U16C1 ] }; // is
    key <AD09> { [ U16A9 ] }; // os
    key <AD10> { [ U16C8 ] }; // peorth
    key <AD11> { [ U16E2 ] }; // cweorth
    key <AD12> { [ U16E5 ] }; // stan

    key <AC01> { [ U16AA ] }; // ac
    key <AC02> { [ U16CB ] }; // sigel
    key <AC03> { [ U16DE ] }; // daeg
    key <AC04> { [ U16A0 ] }; // feoh
    key <AC05> { [ U16B7 ] }; // gyfu
    key <AC06> { [ U16BB ] }; // haegl
    key <AC07> { [ U16C4 ] }; // ger
    key <AC08> { [ U16DF ] }; // ethel
    key <AC09> { [ U16DA ] }; // lagu
    key <AC10> { [ U16E0 ] }; // ear
    key <AC11> { [ U16E1 ] }; // ior

    key <AB01> { [ U16AB ] }; // aesc
    key <AB02> { [ U16C9 ] }; // eolhx
    key <AB03> { [ U16B3 ] }; // cen
    key <AB04> { [ U16A6 ] }; // thorn
    key <AB05> { [ U16D2 ] }; // beorc
    key <AB06> { [ U16BE ] }; // nyd
    key <AB07> { [ U16D7 ] }; // mann
    key <AB08> { [ U16DD ] }; // Ing
    key <AB09> { [ U16E3, U16E4 ] }; // calc, cealc
    key <AB10> { [ U16B8 ] }; // gar
};
« Last Edit: April 04, 2021, 10:41:00 PM by la xasop »
when you try to mock anyone while also running the flat earth society. Lol

*

Offline xasop

  • Administrator
  • *****
  • Posts: 7802
  • Professional computer somebody
    • View Profile
Re: Custom keyboard layouts in X11
« Reply #5 on: May 25, 2021, 10:27:41 AM »
Behold! My new enieplfr keyboard layout. I use a ThinkPad T14, which has the PrtSc key right next to AltGr.



Now, I never use the PrtSc key, but I do type in multiple languages, so I decided to put it to good use. In technical terms, pressing a key on its own is level 1, the Shift key is a level 2 shift, and AltGr is a level 3 shift. Pressing Shift and AltGr together gives a level 4 shift, giving 4 different characters a key can produce.

In an X keyboard layout, one can also designate a level 5 shift key, which combines with Shift and AltGr to give 8 different characters per key. I have assigned this role to PrtSc, with the following behaviour:
  • AltGr functions as the ie_ansi keyboard layout I posted previously, which provides useful characters for both Irish and French. I have also added guillemets and non-breaking spaces for use in weirdo French quotes.
  • PrtSc functions as the AltGr key on a standard Polish "programmer's" keyboard.
  • Pressing AltGr and PrtSc together produces circumflex vowels as well as ç, which are some of the less common French letters. This isn't as awkward as it sounds because the two keys are adjacent and fairly small, so I can press them both with one thumb.
  • Additionally, I have changed the backtick key to function as a dead key for the grave accent, which is also used in French.
  • The remaining French characters — æ, œ and vowels with diaereses — are not included in this layout. They are relatively uncommon, so typing them using XCompose sequences is not a great burden.
The big advantage of all this is that, if neither AltGr nor PrtSc is depressed, the keyboard still functions like a standard US layout, except for the dead grave key, which I consider acceptable because I rarely use backticks.

Without further ado, I present to ye the enieplfr layout, courtesy of yours truly.

Code: [Select]
xkb_symbols "basic" {
    include "us(basic)"

    name[Group1] = "English/Irish/Polish/French";

    // grave accent
    key.type[Group1] = "TWO_LEVEL";
    key <TLDE> { [ dead_grave, asciitilde ] };

    // Euro on 5 key
    key.type[Group1] = "FOUR_LEVEL";
    key <AE05> { [   NoSymbol,   NoSymbol,       EuroSign,         cent ] };

    // Q row
    key.type[Group1] = "EIGHT_LEVEL";
    key <AD03> { [   NoSymbol,   NoSymbol,         eacute,       Eacute,   eogonek,   Eogonek, ecircumflex, Ecircumflex ] };
    key.type[Group1] = "FOUR_LEVEL";
    key <AD04> { [   NoSymbol,   NoSymbol,      0x100027C,     NoSymbol ] };
                                                // long r
    key <AD05> { [   NoSymbol,   NoSymbol,      tabovedot,    Tabovedot ] };
    key.type[Group1] = "EIGHT_LEVEL";
    key <AD07> { [   NoSymbol,   NoSymbol,         uacute,       Uacute,  NoSymbol,  NoSymbol, ucircumflex, Ucircumflex ] };
    key <AD08> { [   NoSymbol,   NoSymbol,         iacute,       Iacute,  NoSymbol,  NoSymbol, icircumflex, Icircumflex ] };
    key <AD09> { [   NoSymbol,   NoSymbol,         oacute,       Oacute,    oacute,    Oacute, ocircumflex, Ocircumflex ] };
    key.type[Group1] = "FOUR_LEVEL";
    key <AD10> { [   NoSymbol,   NoSymbol,      pabovedot,    Pabovedot ] };

    // A row
    key.type[Group1] = "EIGHT_LEVEL";
    key <AC01> { [   NoSymbol,   NoSymbol,         aacute,       Aacute,   aogonek,   Aogonek, acircumflex, Acircumflex ] };
    key <AC02> { [   NoSymbol,   NoSymbol,      sabovedot,    Sabovedot,    sacute,    Sacute ] };
    key.type[Group1] = "FOUR_LEVEL";
    key <AC03> { [   NoSymbol,   NoSymbol,      dabovedot,    Dabovedot ] };
    key <AC04> { [   NoSymbol,   NoSymbol,      fabovedot,    Fabovedot ] };
    key <AC05> { [   NoSymbol,   NoSymbol,      gabovedot,    Gabovedot ] };
    key.type[Group1] = "EIGHT_LEVEL";
    key <AC09> { [   NoSymbol,   NoSymbol,       NoSymbol,     NoSymbol,   lstroke,   Lstroke ] };

    // Z row
    key <AB01> { [   NoSymbol,   NoSymbol,      0x100017F,    0x1001E9B, zabovedot, Zabovedot ] };
                                                // long s,   long s dot
    key <AB02> { [   NoSymbol,   NoSymbol,       NoSymbol,     NoSymbol,    zacute,    Zacute ] };
    key <AB03> { [   NoSymbol,   NoSymbol,      cabovedot,    Cabovedot,    cacute,    Cacute,    ccedilla,    Ccedilla ] };
    key.type[Group1] = "FOUR_LEVEL";
    key <AB05> { [   NoSymbol,   NoSymbol,      babovedot,    Babovedot ] };
    key.type[Group1] = "EIGHT_LEVEL";
    key <AB06> { [   NoSymbol,   NoSymbol,       NoSymbol,     NoSymbol,    nacute,    Nacute ] };
    key.type[Group1] = "FOUR_LEVEL";
    key <AB07> { [   NoSymbol,   NoSymbol,      mabovedot,    Mabovedot ] };
    key <AB08> { [   NoSymbol,   NoSymbol,  guillemotleft ] };
    key <AB09> { [   NoSymbol,   NoSymbol, guillemotright ] };

    // spaces
    key <SPCE> { [      space,      space,   nobreakspace, nobreakspace ] };

    include "level3(ralt_switch)"

    key <PRSC> {
        type[Group1] = "ONE_LEVEL",
        symbols[Group1] = [ ISO_Level5_Shift ]
    };
    include "level5(modifier_mapping)"
};
« Last Edit: May 25, 2021, 11:50:42 AM by xasop »
when you try to mock anyone while also running the flat earth society. Lol

*

Offline xasop

  • Administrator
  • *****
  • Posts: 7802
  • Professional computer somebody
    • View Profile
Re: Custom keyboard layouts in X11
« Reply #6 on: May 25, 2021, 05:27:54 PM »
I modified it further to create an enieplfreo layout that also does Esperanto, by removing characters only needed for the old style of writing Irish and replacing them with Esperanto's circumflexed consonants.

Code: [Select]
xkb_symbols "basic" {
    include "us(basic)"

    name[Group1] = "English/Irish/Polish/French/Esperanto";

    // grave accent
    key.type[Group1] = "TWO_LEVEL";
    key <TLDE> { [ dead_grave, asciitilde ] };

    // Euro on 5 key
    key.type[Group1] = "FOUR_LEVEL";
    key <AE05> { [   NoSymbol,   NoSymbol,       EuroSign,         cent ] };

    // Q row
    key <AD02> { [   NoSymbol,   NoSymbol,         ubreve,       Ubreve ] };
    key.type[Group1] = "EIGHT_LEVEL";
    key <AD03> { [   NoSymbol,   NoSymbol,         eacute,       Eacute,   eogonek,   Eogonek, ecircumflex, Ecircumflex ] };
    key <AD07> { [   NoSymbol,   NoSymbol,         uacute,       Uacute,  NoSymbol,  NoSymbol, ucircumflex, Ucircumflex ] };
    key <AD08> { [   NoSymbol,   NoSymbol,         iacute,       Iacute,  NoSymbol,  NoSymbol, icircumflex, Icircumflex ] };
    key <AD09> { [   NoSymbol,   NoSymbol,         oacute,       Oacute,    oacute,    Oacute, ocircumflex, Ocircumflex ] };

    // A row
    key <AC01> { [   NoSymbol,   NoSymbol,         aacute,       Aacute,   aogonek,   Aogonek, acircumflex, Acircumflex ] };
    key <AC02> { [   NoSymbol,   NoSymbol,    scircumflex,  Scircumflex,    sacute,    Sacute ] };
    key.type[Group1] = "FOUR_LEVEL";
    key <AC05> { [   NoSymbol,   NoSymbol,    gcircumflex,  Gcircumflex ] };
    key <AC06> { [   NoSymbol,   NoSymbol,    hcircumflex,  Hcircumflex ] };
    key <AC07> { [   NoSymbol,   NoSymbol,    jcircumflex,  Jcircumflex ] };
    key.type[Group1] = "EIGHT_LEVEL";
    key <AC09> { [   NoSymbol,   NoSymbol,       NoSymbol,     NoSymbol,   lstroke,   Lstroke ] };

    // Z row
    key <AB01> { [   NoSymbol,   NoSymbol,       NoSymbol,     NoSymbol, zabovedot, Zabovedot ] };
    key <AB02> { [   NoSymbol,   NoSymbol,       NoSymbol,     NoSymbol,    zacute,    Zacute ] };
    key <AB03> { [   NoSymbol,   NoSymbol,    ccircumflex,  Ccircumflex,    cacute,    Cacute,    ccedilla,    Ccedilla ] };
    key <AB06> { [   NoSymbol,   NoSymbol,       NoSymbol,     NoSymbol,    nacute,    Nacute ] };
    key.type[Group1] = "FOUR_LEVEL";
    key <AB08> { [   NoSymbol,   NoSymbol,  guillemotleft ] };
    key <AB09> { [   NoSymbol,   NoSymbol, guillemotright ] };

    // spaces
    key <SPCE> { [      space,      space,   nobreakspace, nobreakspace ] };

    include "level3(ralt_switch)"

    key <PRSC> {
        type[Group1] = "ONE_LEVEL",
        symbols[Group1] = [ ISO_Level5_Shift ]
    };
    include "level5(modifier_mapping)"
};
« Last Edit: May 25, 2021, 05:30:47 PM by xasop »
when you try to mock anyone while also running the flat earth society. Lol

*

Offline xasop

  • Administrator
  • *****
  • Posts: 7802
  • Professional computer somebody
    • View Profile
Re: Custom keyboard layouts in X11
« Reply #7 on: July 07, 2021, 11:49:56 PM »
I've been making some more tweaks. It now supports all letters and diacritics used in the 10 most widely spoken languages in the EU, plus Esperanto. The placement of keys is mostly mnemonic — AltGr gives Western European variants of letters, PrtSc Eastern European, and AltGr+PrtSc less common ones. In some cases, the placement is based on the keyboard layout normally used for typing that language. There are now two dead keys, for grave and tilde accents.

There is a point of diminishing returns trying to support more European languages. I could try to include å for Swedish, č for Czech and ø for Danish, but all of the logical places for those are taken, so it would be difficult to remember. XCompose is more convenient for these less common languages, since it involves more keystrokes but is more intuitive to use.

I have named this new layout europa, for the great number of European languages it now supports — more languages than the "US International" layout, and more intuitive to use.

Code: [Select]
xkb_symbols "basic" {
    include "us(basic)"

    name[Group1] = "Europa";

    // grave accent
    key.type[Group1] = "TWO_LEVEL";
    key <TLDE> { [ dead_grave, dead_tilde ] };

    // inverted exclamation mark
    key.type[Group1] = "FOUR_LEVEL";
    key <AE01> { [   NoSymbol,   NoSymbol,     exclamdown,     exclamdown ] };

    // Euro on 5 key
    key <AE05> { [   NoSymbol,   NoSymbol,       EuroSign,           cent ] };

    // Q row
    key <AD02> { [   NoSymbol,   NoSymbol,         ubreve,         Ubreve ] };
    key.type[Group1] = "EIGHT_LEVEL";
    key <AD03> { [   NoSymbol,   NoSymbol,         eacute,         Eacute,     eogonek,     Eogonek,  ecircumflex,  Ecircumflex ] };
    key <AD07> { [   NoSymbol,   NoSymbol,         uacute,         Uacute,    NoSymbol,    NoSymbol,  ucircumflex,  Ucircumflex ] };
    key <AD08> { [   NoSymbol,   NoSymbol,         iacute,         Iacute,    NoSymbol,    NoSymbol,  icircumflex,  Icircumflex ] };
    key <AD09> { [   NoSymbol,   NoSymbol,         oacute,         Oacute,      oacute,      Oacute,  ocircumflex,  Ocircumflex ] };
    key <AD11> { [   NoSymbol,   NoSymbol,     udiaeresis,     Udiaeresis,      abreve,      Abreve, udoubleacute, Udoubleacute ] };
    key <AD12> { [   NoSymbol,   NoSymbol,       NoSymbol,       NoSymbol, icircumflex, Icircumflex ] };
    key <BKSL> { [   NoSymbol,   NoSymbol,       NoSymbol,       NoSymbol, acircumflex, Acircumflex ] };

    // A row
    key <AC01> { [   NoSymbol,   NoSymbol,         aacute,         Aacute,     aogonek,     Aogonek,  acircumflex,  Acircumflex ] };
    key <AC02> { [   NoSymbol,   NoSymbol,         ssharp,         ssharp,      sacute,      Sacute,  scircumflex,  Scircumflex ] };
    key.type[Group1] = "FOUR_LEVEL";
    key <AC05> { [   NoSymbol,   NoSymbol,    gcircumflex,    Gcircumflex ] };
    key <AC06> { [   NoSymbol,   NoSymbol,    hcircumflex,    Hcircumflex ] };
    key <AC07> { [   NoSymbol,   NoSymbol,    jcircumflex,    Jcircumflex ] };
    key.type[Group1] = "EIGHT_LEVEL";
    key <AC09> { [   NoSymbol,   NoSymbol,             oe,             OE,     lstroke,     Lstroke ] };
    key <AC10> { [   NoSymbol,   NoSymbol,     odiaeresis,     Odiaeresis,       U0219,       U0218, odoubleacute, Odoubleacute ] };
    key <AC11> { [   NoSymbol,   NoSymbol,     adiaeresis,     Adiaeresis,       U021B,       U021A ] };

    // Z row
    key <AB01> { [   NoSymbol,   NoSymbol,             ae,             AE,   zabovedot,   Zabovedot ] };
    key <AB02> { [   NoSymbol,   NoSymbol,       NoSymbol,       NoSymbol,      zacute,      Zacute ] };
    key <AB03> { [   NoSymbol,   NoSymbol,       ccedilla,       Ccedilla,      cacute,      Cacute,  ccircumflex,  Ccircumflex ] };
    key <AB06> { [   NoSymbol,   NoSymbol,         ntilde,         ntilde,      nacute,      Nacute ] };
    key.type[Group1] = "FOUR_LEVEL";
    key <AB08> { [   NoSymbol,   NoSymbol,  guillemotleft,  guillemotleft ] };
    key <AB09> { [   NoSymbol,   NoSymbol, guillemotright, guillemotright ] };
    key <AB10> { [   NoSymbol,   NoSymbol,   questiondown,   questiondown ] };

    // spaces
    key <SPCE> { [      space,      space,   nobreakspace,   nobreakspace ] };

    include "level3(ralt_switch)"

    key <PRSC> {
        type[Group1] = "ONE_LEVEL",
        symbols[Group1] = [ ISO_Level5_Shift ]
    };
    include "level5(modifier_mapping)"
};
« Last Edit: July 09, 2021, 04:54:03 AM by xasop »
when you try to mock anyone while also running the flat earth society. Lol