├── LICENSE
├── README.md
├── xkeyboard-config_2.19.patch
└── xkeyboard-config_2.23.patch
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Michal Kahle
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Use both US and Czech keyboard layout in Linux without switching
2 | Constant keyboard layout switching hampers your productivity. It certainly hampered mine. With this keyboard layout you can forget about keyboard switching and let your muscle memory handle it.
3 |
4 | Czech coder layout is inspired by the Czech Programmers keyboard layout in Windows with **one significant difference:** Czech coder lets you type fluently in Czech with pressed AltGr without the need to release it! When you do release the AltGr, you are back to US layout which is optimal for coding.
5 |
6 | ### How it works
7 | The basic layout is US so that all symbols are available and all keyboard shortcuts work as intended. When you hold AltGr with your right thumb the layout changes to Czech (qwerty variant; there is as little rearrangement as possible). With use, you will learn to press the right Alt unconsciously.
8 |
9 | Upper case of accented letters are available with AltGr + Shift combination. Euro sign is available under AltGr + Shift + e.
10 |
11 | ### Disadvantages and compromises
12 | - Location of right thumb on AltGr is in an awkward position under your palm on most keyboards and it makes longer typing in Czech inconvenient. I certainly wouldn't want to write a novel this way. But it is ok for short snippets of text.
13 | - Only left thumb is left to type spaces in Czech.
14 | - There is a small inconsistency because of the euro sign where you have to release AltGr to type upper case "E" when writing Czech.
15 |
16 | ### Installation
17 | Unfortunately, the following instructions **do not work with Wayland**. There are only instructions for SwayWM for now. Please help me to make it work there. I'll update these instructions when I learn the proper way how to switch keyboard layouts on Wayland.
18 |
19 | On Ubuntu 20.4 and later or its derivatives the 'coder' variant is already present.
20 | - You can switch to it temporarily by `setxkbmap -layout cz -variant coder`.
21 | - 'coder' variant is registered in [the 'extras' section as an 'exotic' layout](https://www.freedesktop.org/wiki/Software/XKeyboardConfig/Rules/#layoutsvariants). Therefore, you won't see it by default in Gnome Settings Input Sources. You will have to set `gsettings set org.gnome.desktop.input-sources show-all-sources true` and reopen your settings app to see it. Set it as the only input source and restart your Gnome session.
22 | - Alternatively, you can set czech-coder as your only Gnome imput source on the command line: `gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'cz+coder')]"`
23 | - For MATE desktop: `gsettings set org.mate.peripherals-keyboard-xkb.kbd layouts "['cz\tcoder']"`
24 |
25 | In older versions of Debian/Ubuntu/Mint:
26 | - Find out which version of `xkb-data` package is installed: `apt list xkb-data`
27 | - cd to the xkb directory: `cd /usr/share/X11/xkb/`
28 | - patch some files (backups are created):
29 | - for version 2.19 - 2.22: `sudo curl https://raw.githubusercontent.com/michalkahle/czech-coder-xkb/master/xkeyboard-config_2.19.patch | sudo patch -bp1`
30 | - for version 2.23 - 2.27: `sudo curl https://raw.githubusercontent.com/michalkahle/czech-coder-xkb/master/xkeyboard-config_2.23.patch | sudo patch -bp1`
31 | - for version 2.28 and later: the 'coder' variant is already present, see above.
32 | - to test you can switch layout without X11 restart: `setxkbmap -layout cz -variant coder`
33 | - to uninstall: `sudo apt install --reinstall xkb-data`.
34 |
35 | Other distros:
36 | Look into the patches what needs to be done. When you make it work, please submit PR with instructions.
37 |
38 | If you run into troubles please open an issue so that we can fix it.
39 |
40 | Very similar layout is [available for macOS](http://blog.destil.cz/2012/10/ceska-programatorska-klavesnice-pro-mac.html).
41 |
42 | #### Wayland
43 |
44 | In wayland, input and output configuration is the job of the compositor. Thus, setting a keyboard layout varies.
45 |
46 | For SwayWM, add this to your config:
47 | ```
48 | input * {
49 | xkb_layout "cz"
50 | xkb_variant "coder"
51 | }
52 | ```
53 |
54 | Or if you want to use multiple layouts in the same time _(and switch them by CapsLock)_:
55 | ```
56 | input "type:keyboard" {
57 | xkb_layout "cz(coder),us"
58 | xkb_options "grp:caps_toggle,grp_led:caps"
59 | }
60 | ```
61 |
62 |
63 | If you know how to set up keyboard layout for other WMs/DEs, please submit a PR.
64 |
65 | # Používejte na Linuxu americké i české rozložení kláves bez přepínání
66 | Neustálé přepínání rozložení klávesnice sníží vaši produktivitu. Mně strašně lezlo na nervy. S tímto rozložením můžete přestat myslet na přepínání klávesnice a nechat to vašemu podvědomí.
67 |
68 | Rozložení Czech coder bylo inspirováno Českým programátorským rozložením pro Windows **s jedním zásadním rozdílem:** České programátorské rozložení umožňuje psát znaky s diakritikou po stisku AltGr, ale znaky bez diakritiky nejsou v tomto módu dostupné. Musíte pustit AltGr, abyste je mohli napsat. To znamená nutnost stisknout a uvolnit AltGr i několikrát při psaní jednoho slova! To je při psaní všemi deseti zcela nepoužitelné. Rozložení Czech coder tohle řeší a umožní vám psát celé věty a odstavce česky se stisknutým AltGr.
69 |
70 | ### Jak to funguje
71 | Základní rozložení je US, takže jsou dostupné všechny symboly a klávesové zkratky fungují bez problémů. Při stisku AltGr pravým palcem se rozložení změní na české (querty, aby byly změny minimální). S používáním se brzy naučíte mačkat AltGr při psaní češtiny podvědomě.
72 |
73 | Velká písmena s diakritikou jsou dostupná s AltGr + Shift. Znak euro je dostupný pod AltGr + Shift + e.
74 |
75 | Návod na instalaci výše.
76 |
--------------------------------------------------------------------------------
/xkeyboard-config_2.19.patch:
--------------------------------------------------------------------------------
1 | diff -raN '--unified=5' orig-2.19/rules/base.lst patched-2.19/rules/base.lst
2 | --- orig-2.19/rules/base.lst 2019-08-09 19:10:04.712231939 +0200
3 | +++ patched-2.19/rules/base.lst 2019-08-09 14:15:55.473909257 +0200
4 | @@ -402,10 +402,11 @@
5 | alternatequotes hr: Croatian (with guillemets for quotes)
6 | unicode hr: Croatian (with Croatian digraphs)
7 | unicodeus hr: Croatian (US keyboard with Croatian digraphs)
8 | us hr: Croatian (US keyboard with Croatian letters)
9 | bksl cz: Czech (with <\|> key)
10 | + coder cz: Czech (coder)
11 | qwerty cz: Czech (qwerty)
12 | qwerty_bksl cz: Czech (qwerty, extended Backslash)
13 | ucw cz: Czech (UCW layout, accented letters only)
14 | dvorak-ucw cz: Czech (US Dvorak with CZ UCW support)
15 | rus cz: Russian (Czech, phonetic)
16 | diff -raN '--unified=5' orig-2.19/rules/base.xml patched-2.19/rules/base.xml
17 | --- orig-2.19/rules/base.xml 2019-08-09 19:10:04.712231939 +0200
18 | +++ patched-2.19/rules/base.xml 2019-08-09 18:08:33.141079867 +0200
19 | @@ -2676,10 +2676,16 @@
20 | Czech (with <\|> key)
21 |
22 |
23 |
24 |
25 | + coder
26 | + Czech (coder)
27 | +
28 | +
29 | +
30 | +
31 | qwerty
32 | Czech (qwerty)
33 |
34 |
35 |
36 | diff -raN '--unified=5' orig-2.19/rules/evdev.lst patched-2.19/rules/evdev.lst
37 | --- orig-2.19/rules/evdev.lst 2019-08-09 19:10:04.712231939 +0200
38 | +++ patched-2.19/rules/evdev.lst 2019-08-09 14:15:55.473909257 +0200
39 | @@ -402,10 +402,11 @@
40 | alternatequotes hr: Croatian (with guillemets for quotes)
41 | unicode hr: Croatian (with Croatian digraphs)
42 | unicodeus hr: Croatian (US keyboard with Croatian digraphs)
43 | us hr: Croatian (US keyboard with Croatian letters)
44 | bksl cz: Czech (with <\|> key)
45 | + coder cz: Czech (coder)
46 | qwerty cz: Czech (qwerty)
47 | qwerty_bksl cz: Czech (qwerty, extended Backslash)
48 | ucw cz: Czech (UCW layout, accented letters only)
49 | dvorak-ucw cz: Czech (US Dvorak with CZ UCW support)
50 | rus cz: Russian (Czech, phonetic)
51 | diff -raN '--unified=5' orig-2.19/rules/evdev.xml patched-2.19/rules/evdev.xml
52 | --- orig-2.19/rules/evdev.xml 2019-08-09 19:10:04.712231939 +0200
53 | +++ patched-2.19/rules/evdev.xml 2019-08-09 18:08:33.141079867 +0200
54 | @@ -2676,10 +2676,16 @@
55 | Czech (with <\|> key)
56 |
57 |
58 |
59 |
60 | + coder
61 | + Czech (coder)
62 | +
63 | +
64 | +
65 | +
66 | qwerty
67 | Czech (qwerty)
68 |
69 |
70 |
71 | diff -raN '--unified=5' orig-2.19/symbols/cz patched-2.19/symbols/cz
72 | --- orig-2.19/symbols/cz 2019-08-09 19:10:04.712231939 +0200
73 | +++ patched-2.19/symbols/cz 2019-08-09 16:47:06.266766048 +0200
74 | @@ -251,5 +251,35 @@
75 |
76 | partial alphanumeric_keys
77 | xkb_symbols "sun_type6" {
78 | include "sun_vndr/cz(sun_type6)"
79 | };
80 | +
81 | +partial alphanumeric_keys alternate_group
82 | +xkb_symbols "coder" {
83 | +
84 | + // US layout with Czech chars under AltGr
85 | +
86 | + include "us"
87 | + name[Group1]= "Czech (coder)";
88 | +
89 | + key {[ grave, asciitilde, semicolon, dead_abovering ]};
90 | + key {[ 2, at, ecaron, Ecaron ]};
91 | + key {[ 3, numbersign, scaron, Scaron ]};
92 | + key {[ 4, dollar, ccaron, Ccaron ]};
93 | + key {[ 5, percent, rcaron, Rcaron ]};
94 | + key {[ 6, asciicircum, zcaron, Zcaron ]};
95 | + key {[ 7, ampersand, yacute, Yacute ]};
96 | + key {[ 8, asterisk, aacute, Aacute ]};
97 | + key {[ 9, parenleft, iacute, Iacute ]};
98 | + key {[ 0, parenright, eacute, Eacute ]};
99 | + key {[ equal, plus, dead_acute, dead_caron ]};
100 | +
101 | + key {[ e, E, e, EuroSign ]};
102 | + key {[ bracketleft, braceleft, uacute, Uacute ]};
103 | +
104 | + key {[ semicolon, colon, uring, Uring ]};
105 | + key {[ apostrophe, quotedbl, section, quotedbl ]};
106 | + key {[ backslash, bar, dead_diaeresis, apostrophe ]};
107 | +
108 | + include "level3(ralt_switch)"
109 | +};
110 |
--------------------------------------------------------------------------------
/xkeyboard-config_2.23.patch:
--------------------------------------------------------------------------------
1 | diff -raN '--unified=5' orig-2.23/rules/base.lst patched-2.23/rules/base.lst
2 | --- orig-2.23/rules/base.lst 2019-09-16 12:47:11.151840274 +0200
3 | +++ patched-2.23/rules/base.lst 2019-09-16 15:02:36.427834523 +0200
4 | @@ -414,10 +414,11 @@
5 | alternatequotes hr: Croatian (with guillemets)
6 | unicode hr: Croatian (with Croatian digraphs)
7 | unicodeus hr: Croatian (US, with Croatian digraphs)
8 | us hr: Croatian (US, with Croatian letters)
9 | bksl cz: Czech (with <\|> key)
10 | + coder cz: Czech (coder)
11 | qwerty cz: Czech (QWERTY)
12 | qwerty_bksl cz: Czech (QWERTY, extended backslash)
13 | ucw cz: Czech (UCW, only accented letters)
14 | dvorak-ucw cz: Czech (US, Dvorak, UCW support)
15 | rus cz: Russian (Czech, phonetic)
16 | diff -raN '--unified=5' orig-2.23/rules/base.xml patched-2.23/rules/base.xml
17 | --- orig-2.23/rules/base.xml 2019-09-16 12:47:29.043413615 +0200
18 | +++ patched-2.23/rules/base.xml 2019-09-16 14:15:54.401602046 +0200
19 | @@ -2752,10 +2752,16 @@
20 | Czech (with <\|> key)
21 |
22 |
23 |
24 |
25 | + coder
26 | + Czech (coder)
27 | +
28 | +
29 | +
30 | +
31 | qwerty
32 | Czech (QWERTY)
33 |
34 |
35 |
36 | diff -raN '--unified=5' orig-2.23/rules/evdev.lst patched-2.23/rules/evdev.lst
37 | --- orig-2.23/rules/evdev.lst 2019-09-16 12:48:03.010606818 +0200
38 | +++ patched-2.23/rules/evdev.lst 2019-09-16 15:05:02.760652194 +0200
39 | @@ -414,10 +414,11 @@
40 | alternatequotes hr: Croatian (with guillemets)
41 | unicode hr: Croatian (with Croatian digraphs)
42 | unicodeus hr: Croatian (US, with Croatian digraphs)
43 | us hr: Croatian (US, with Croatian letters)
44 | bksl cz: Czech (with <\|> key)
45 | + coder cz: Czech (coder)
46 | qwerty cz: Czech (QWERTY)
47 | qwerty_bksl cz: Czech (QWERTY, extended backslash)
48 | ucw cz: Czech (UCW, only accented letters)
49 | dvorak-ucw cz: Czech (US, Dvorak, UCW support)
50 | rus cz: Russian (Czech, phonetic)
51 | diff -raN '--unified=5' orig-2.23/rules/evdev.xml patched-2.23/rules/evdev.xml
52 | --- orig-2.23/rules/evdev.xml 2019-09-16 12:48:18.878231306 +0200
53 | +++ patched-2.23/rules/evdev.xml 2019-09-16 14:15:54.401602046 +0200
54 | @@ -2752,10 +2752,16 @@
55 | Czech (with <\|> key)
56 |
57 |
58 |
59 |
60 | + coder
61 | + Czech (coder)
62 | +
63 | +
64 | +
65 | +
66 | qwerty
67 | Czech (QWERTY)
68 |
69 |
70 |
71 | diff -raN '--unified=5' orig-2.23/symbols/cz patched-2.23/symbols/cz
72 | --- orig-2.23/symbols/cz 2019-09-16 12:49:04.769149939 +0200
73 | +++ patched-2.23/symbols/cz 2019-09-16 14:15:54.405601957 +0200
74 | @@ -251,5 +251,35 @@
75 |
76 | partial alphanumeric_keys
77 | xkb_symbols "sun_type6" {
78 | include "sun_vndr/cz(sun_type6)"
79 | };
80 | +
81 | +partial alphanumeric_keys alternate_group
82 | +xkb_symbols "coder" {
83 | +
84 | + // US layout with Czech chars under AltGr
85 | +
86 | + include "us"
87 | + name[Group1]= "Czech (coder)";
88 | +
89 | + key {[ grave, asciitilde, semicolon, dead_abovering ]};
90 | + key {[ 2, at, ecaron, Ecaron ]};
91 | + key {[ 3, numbersign, scaron, Scaron ]};
92 | + key {[ 4, dollar, ccaron, Ccaron ]};
93 | + key {[ 5, percent, rcaron, Rcaron ]};
94 | + key {[ 6, asciicircum, zcaron, Zcaron ]};
95 | + key {[ 7, ampersand, yacute, Yacute ]};
96 | + key {[ 8, asterisk, aacute, Aacute ]};
97 | + key {[ 9, parenleft, iacute, Iacute ]};
98 | + key {[ 0, parenright, eacute, Eacute ]};
99 | + key {[ equal, plus, dead_acute, dead_caron ]};
100 | +
101 | + key {[ e, E, e, EuroSign ]};
102 | + key {[ bracketleft, braceleft, uacute, Uacute ]};
103 | +
104 | + key {[ semicolon, colon, uring, Uring ]};
105 | + key {[ apostrophe, quotedbl, section, quotedbl ]};
106 | + key {[ backslash, bar, dead_diaeresis, apostrophe ]};
107 | +
108 | + include "level3(ralt_switch)"
109 | +};
110 |
--------------------------------------------------------------------------------