Neat keyboard setup

    Around us there are more and more people who know how a hyphen differs from a minus, minus from a dash, and an inch sign from quotes. What can I say, the secretary sent me a letter yesterday, typographed accurately. In order to get a little closer to perfection, it is not necessary to burden yourself with an “additional symbols” open window and a dull copy-paste from there.
    Most of the problems in modern window managers are solved by regular means. But what about those who want to be able to type some exotic symbols with one click, like the infinity sign (∞), integral (∫) or card suits ()?
    Under the cut, I’ll tell you how to set up the keyboard for the correct typography (“-”) using regular tools, and how to expand the capabilities to quickly type any characters.

    Established funds


    Established tools provide a “ Birman layout ” (you can see what opportunities will appear after its inclusion by the link). Additional characters are entered by simultaneously pressing the right Alt(so-called AltGr) and the corresponding keys on the keyboard. Believe me, you can get used to this method in a week - and then enjoy your whole life.
    NB! In both window managers, it is necessary to verify that the third-level key is active and assigned.

    Kde


    Right-clicking on the keyboard layout applet and switching to the “Advanced” tab will lead us to this choice:
    Keyboard Setup for KDE

    Here you need to “Enable additional typographic characters” - and you're done. You can test.

    GNOME


    Right-clicking on the keyboard layout applet, switching to the Layouts tab and clicking on the Layout Settings ... button will bring us to this choice:
    Keyboard setup for GNOME

    Here you need to "Enable additional typographic characters" - and you're done. You can test.

    Freelance Fine-Tuning


    Everything above is written so for pro forma. I hope that in 2011 everyone knows about it without me. Our goal is to customize the keyboard for ourselves, as conveniently as possible, with those symbols that we need every day.
    There are two ways to achieve the desired effect: one is fast, the other is correct. The quick one is to directly edit the layout file with additional characters ( /usr/share/X11/xkb/symbols/typo). Two years ago (since then I have not tried), the modified file lived strictly until the next X update. Perhaps it will be convenient for someone to change this file, make a backup copy and overwrite it every time a new “system” version comes in, I don’t know. But I choose a more elegant way.
    $ sudo cp /usr/share/X11/xkb/symbols/typo /usr/share/X11/xkb/symbols/mytypo
    $ sudo vi /usr/share/X11/xkb/symbols/mytypo
    

    You can read about the format of this file on the net, but it is already so intuitive:
    // $XKeyboardConfig$
    // typographic keyboard
    // Sergei Stolyarov 
    //
    // Initial contribution by Alexey Ten 
    //
    // Based on the layout proposed by Ilya Birman, 
    // http://ilyabirman.ru/typography-layout/
    //
    // default layout
    default partial
    xkb_symbols "base" {
    // 1st keyboard row 
        key  { [NoSymbol, NoSymbol, NoSymbol, approxeq] };
        key  { [NoSymbol, NoSymbol, onesuperior] };
        key  { [NoSymbol, NoSymbol, twosuperior, onehalf] };
        key  { [NoSymbol, NoSymbol, threesuperior, onethird] };
        key  { [NoSymbol, NoSymbol, dollar, onequarter] };
        key  { [NoSymbol, NoSymbol, U2030] };
        key  { [NoSymbol, NoSymbol, ampersand] };
        key  { [NoSymbol, NoSymbol, enfilledcircbullet, oneeighth] };
        key  { [NoSymbol, NoSymbol, emdash, hyphen] };
        key  { [NoSymbol, NoSymbol, notequal, plusminus] };
    // 2nd keyboard row 
    // Далее еще много таких же строчек
    … 
    

    We are interested in the third level - this is the third (with the key pressed AltGr) and the fourth (with the keys pressed Shiftand AltGr) the values ​​in each line. NoSymbolin the first two columns do not need to touch ! - This is an additional layout that affects only the third level. Let's add some character to the key combination Shift+AltGr+1(in the lower case there is now “onesuperior” - mnemonics for “to the power of 1” - “¹”, and the upper one is just free). Let it be a sign of approximate equality (≈). Fortunately, you don’t need to memorize mnemonics: instead of them, you can simply enter numerical values ​​of characters in the format “0x100XXXX”, where XXXX is the unicode value in the hexadecimal number system. The value of "≈" = 2248; just replace the line:
        key  { [NoSymbol, NoSymbol, onesuperior] };
    

    on the:
        key  { [NoSymbol, NoSymbol, onesuperior, 0x1002248] };
    

    Now is the time to tell the window manager about our new layout.

    Kde


    Keyboard switch settings are stored in a file ~/.kde/share/config/kxkbrc. We open it in the editor and (surprise) replace it typowith mytypo:
    [Layout]
    DisplayNames=,
    IndicatorOnly=false
    LayoutList=us,ru
    LayoutLoopCount=-1
    Model=pc104                                                      ⇓⇓
    Options=grp:alt_shift_toggle,grp_led:scroll,lv3:ralt_switch,misc:mytypo,numpad:microsoft,altwin:menu,keypad:oss
    ResetOldOptions=true                                             ⇑⇑
    ShowFlag=true
    ShowLayoutIndicator=true
    ShowSingle=true
    SwitchMode=WinClass
    Use=true
    

    GNOME


    Keyboard switch settings are stored in a file ~/.gconf/desktop/gnome/peripherals/keyboard/kbd/%gconf.xml. We open it in the editor and (surprise) replace it typowith mytypo:
  • grp grp:alt_shift_toggle
  • lv3 lv3:ralt_switch
  • keypad keypad:future
  • grp_led grp_led:scroll
  • nbsp nbsp:level3
  • compat numpad:microsoft
  • ⇓⇓ compat misc:mytypo
  • ⇑⇑
  • ru
  • us

  • It remains to click the layout back and forth - and you can use it (on some systems, I did not reveal a pattern, I need to restart the X).
    Have a nice set!

    Also popular now: