📜 ⬆️ ⬇️

Accurate keyboard setup

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

Regular funds


Regular tools provide a " layout of Birman " (by reference you can see what opportunities will appear after its inclusion). Additional characters are entered by simultaneously pressing the right Alt ( AltGr ) and the corresponding key 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, you need to check 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 configuration for KDE

Here you need to "Include 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 Options ... button will lead us to this choice:
GNOME keyboard customization

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

Freelance fine tuning


Everything above is written in the form of pro forma. I hope that in 2011 they know everything about it without me. Our goal is to customize the keyboard for yourself, as convenient as possible, with the characters that we need every day.
There are two ways to achieve the desired effect: one is fast, the other is right. The quick one is to directly edit the layout file with additional symbols ( /usr/share/X11/xkb/symbols/typo ). Two years ago (since 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 rolls 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 online, but it is already intuitive:
 // $XKeyboardConfig$ // typographic keyboard // Sergei Stolyarov <sergei@regolit.com> // // Initial contribution by Alexey Ten <alexeyten+deb@gmail.com> // // Based on the layout proposed by Ilya Birman, // http://ilyabirman.ru/typography-layout/ // // default layout default partial xkb_symbols "base" { // 1st keyboard row key <TLDE> { [NoSymbol, NoSymbol, NoSymbol, approxeq] }; key <AE01> { [NoSymbol, NoSymbol, onesuperior] }; key <AE02> { [NoSymbol, NoSymbol, twosuperior, onehalf] }; key <AE03> { [NoSymbol, NoSymbol, threesuperior, onethird] }; key <AE04> { [NoSymbol, NoSymbol, dollar, onequarter] }; key <AE05> { [NoSymbol, NoSymbol, U2030] }; key <AE07> { [NoSymbol, NoSymbol, ampersand] }; key <AE08> { [NoSymbol, NoSymbol, enfilledcircbullet, oneeighth] }; key <AE11> { [NoSymbol, NoSymbol, emdash, hyphen] }; key <AE12> { [NoSymbol, NoSymbol, notequal, plusminus] }; // 2nd keyboard row //       … 

We are interested in the third level - this is the third (with the AltGr key held down) and the fourth (with the Shift and AltGr keys AltGr ) in each line. NoSymbol in 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 Shift+AltGr+1 key combination (in lower case, “onesuperior” is the mnemonic for “to the power of 1” - “”, and the upper one is just free). Let it be a sign of approximate equality (≈). Fortunately, mnemonics do not need to be remembered: instead of them, you can simply enter the numeric values ​​of characters in the format “0x100XXXX”, where XXXX is the Unicode value in hexadecimal notation. The value "≈" = 2248; just replace the line:
  key <AE01> { [NoSymbol, NoSymbol, onesuperior] }; 

on:
  key <AE01> { [NoSymbol, NoSymbol, onesuperior, 0x1002248] }; 

Now it's time to tell the window manager about our new layout.

KDE


Keyboard switch settings are stored in the file ~/.kde/share/config/kxkbrc . Open it in the editor and (surprise) replace typo with 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 the file ~/.gconf/desktop/gnome/peripherals/keyboard/kbd/%gconf.xml . Open it in the editor and (surprise) replace typo with mytypo :
 <?xml version="1.0"?> <gconf> <entry name="options" mtime="1301471398" type="list" ltype="string"> <li type="string"> <stringvalue>grp grp:alt_shift_toggle</stringvalue> </li> <li type="string"> <stringvalue>lv3 lv3:ralt_switch</stringvalue> </li> <li type="string"> <stringvalue>keypad keypad:future</stringvalue> </li> <li type="string"> <stringvalue>grp_led grp_led:scroll</stringvalue> </li> <li type="string"> <stringvalue>nbsp nbsp:level3</stringvalue> </li> <li type="string"> <stringvalue>compat numpad:microsoft</stringvalue> </li> <li type="string"> ⇓⇓ <stringvalue>compat misc:mytypo</stringvalue> </li> ⇑⇑ </entry> <entry name="layouts" mtime="1301471472" type="list" ltype="string"> <li type="string"> <stringvalue>ru</stringvalue> </li> <li type="string"> <stringvalue>us</stringvalue> </li> </entry> </gconf> 

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

')

Source: https://habr.com/ru/post/116485/


All Articles