How to get stable International Dvorak with first-level deadkeys in Debian?

There are some unstable/risky ways such as the thread How to Get A with Dots in Dvorak of Ubuntu 16.04? to get the feature but I cannot run it in many environments.
Germans need their owns (a/e/u/o with dots) as shown here, while nordic (Finland, Sweden, Norway, Denmark, …) people need similar keys (a/o with dots).
I think one-level keyboard approach is better than two-level keyboard approach.
Options

  1. To get such a keyboard layout by default in Debian would be great.
  2. To get a package in apt for such a keyboard would be good.
  3. Maybe an other way …
  4. Doing those changes manually like in the first thread is not an option because of the risks in different environments.

OS X International Dvorak has such a feature by default, which can be used as a benchmark, but also the manual approach as done in the first thread answer.
There is a ticket open in Chromium development for such a feature in the thread International Dvorak with Deadkeys targeted in Chromebook.

Testing clearkimura’s answer in Debian

  1. Output

    masi@masi:~/Downloads$ sudo cp dvorak_intl /usr/share/X11/xkb/symbols/dvorak_intl
    
    masi@masi:~/Downloads$ setxkbmap -verbose dvorak_intl
    
    masi@masi:~/Downloads$ setxkbmap -I ~/.xkb dvorak_intl -print | xkbcomp -I$HOME/.xkb - $DISPLAY
    Warning:          Type "ONE_LEVEL" has 1 levels, but <RALT> has 2 symbols
                  Ignoring extra symbols
    Warning:          Key <OUTP> not found in evdev+aliases(qwerty) keycodes
                  Symbols ignored
    Warning:          Key <KITG> not found in evdev+aliases(qwerty) keycodes
                  Symbols ignored
    Warning:          Key <KIDN> not found in evdev+aliases(qwerty) keycodes
                  Symbols ignored
    Warning:          Key <KIUP> not found in evdev+aliases(qwerty) keycodes
                  Symbols ignored
    Warning:          Key <RO> not found in evdev+aliases(qwerty) keycodes
                  Symbols ignored
    Warning:          Key <I192> not found in evdev+aliases(qwerty) keycodes
                  Symbols ignored
    Warning:          Key <I193> not found in evdev+aliases(qwerty) keycodes
                  Symbols ignored
    Warning:          Key <I194> not found in evdev+aliases(qwerty) keycodes
                  Symbols ignored
    Warning:          Key <I195> not found in evdev+aliases(qwerty) keycodes
                  Symbols ignored
    Warning:          Key <I196> not found in evdev+aliases(qwerty) keycodes
                  Symbols ignored
    Warning:          Key <I255> not found in evdev+aliases(qwerty) keycodes
                  Symbols ignored
    Warning:          No symbols defined for <AB11> (keycode 97)
    Warning:          No symbols defined for <JPCM> (keycode 103)
    Warning:          No symbols defined for <I120> (keycode 120)
    Warning:          No symbols defined for <AE13> (keycode 132)
    Warning:          No symbols defined for <I149> (keycode 149)
    Warning:          No symbols defined for <I154> (keycode 154)
    Warning:          No symbols defined for <I168> (keycode 168)
    Warning:          No symbols defined for <I178> (keycode 178)
    Warning:          No symbols defined for <I183> (keycode 183)
    Warning:          No symbols defined for <I184> (keycode 184)
    Warning:          No symbols defined for <FK19> (keycode 197)
    Warning:          No symbols defined for <FK24> (keycode 202)
    Warning:          No symbols defined for <I217> (keycode 217)
    Warning:          No symbols defined for <I219> (keycode 219)
    Warning:          No symbols defined for <I221> (keycode 221)
    Warning:          No symbols defined for <I222> (keycode 222)
    Warning:          No symbols defined for <I230> (keycode 230)
    Warning:          No symbols defined for <I247> (keycode 247)
    Warning:          No symbols defined for <I248> (keycode 248)
    Warning:          No symbols defined for <I249> (keycode 249)
    Warning:          No symbols defined for <I250> (keycode 250)
    Warning:          No symbols defined for <I251> (keycode 251)
    Warning:          No symbols defined for <I252> (keycode 252)
    Warning:          No symbols defined for <I253> (keycode 253)
    
  2. Restart

  3. Output: the keyboard layout is not active anymore
  4. Go to Region & Language > choose > search Dvorak > Choose Dvorak with dead keys in Fig. 1
  5. Output: the expected keyboard layout now active and selectable in the top bar
  6. In Regien & Language, put your primary keyboard layout at the top in Fig. 2 i.e. remove your previous keyboard layouts at the top. This way, you can put Dvorak international with dead keys as your primary keyboard which stays there also after restart.

Fig. 1 Region & Language settings after the change,
Fig. 2 Region & Language settings when Dvorak international with dead keys as the primary keyboard layout

enter image description here
enter image description here

OS: Debian 8.7
Hardware: Asus Zenbook UX303UB, HP 2002 laptop
Window manager: Gnome 3.14

Answer

This answer shall explain how to install the Dvorak international extended keyboard layout found in this article by Arjen van Kol. The installation and setup were fairly straightforward using XKB.

Install new layout

Download the layout file dvorak_intl from the linked article. Then, copy the file as superuser to /usr/share/X11/xkb/symbols/ with the same filename.

sudo cp dvorak_intl /usr/share/X11/xkb/symbols/dvorak_intl

No need to further change permission. For curious users, use stat command to check the permission. The permission is 644 by default.

$ ls -l /usr/share/X11/xkb/symbols/dvorak_intl 
-rw-r--r-- 1 root root 2989 May 14 17:32 /usr/share/X11/xkb/symbols/dvorak_intl

$ stat -c '%a %n' /usr/share/X11/xkb/symbols/dvorak_intl 
644 /usr/share/X11/xkb/symbols/dvorak_intl

Apply new layout

Before making changes, run setxkbmap -query to check the current layout in case we want to revert the changes later. The layout is us by default.

$ setxkbmap -query
rules:      evdev
model:      pc105
layout:     us   <-- current layout

Now, run setxkbmap command to set the new keyboard layout. The -verbose option was added to see the output, which otherwise will show nothing.

$ setxkbmap -verbose dvorak_intl
Warning! Multiple definitions of keyboard layout
         Using command line, ignoring X server
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+dvorak_intl+inet(evdev)
geometry:   pc(pc105)

User can run again setxkbmap -query to verify the changes that have been made and now being shown in the layout column.

$ setxkbmap -query
rules:      evdev
model:      pc105
layout:     dvorak_intl   <-- new layout

Test new layout

The changes will be effective immediately; no need to logout or reload X server at all. Open a text editor, then press each keys of four rows on the keyboard to see the output.

First and second level keys (without and with Shift):

`1234567890[]
~!@#$%^&*(){}

´,.pyfgcrl/=\
¨<>PYFGCRL?+|

aoeuidhtns-
AOEUIDHTNS_

;qjkxbmwvz
:QJKXBMWVZ

Third and fourth level keys (with AltGr and Shift+AltGr):

 ¡ ♯         
         []{}

´¸…    č     
 «»¶     ¿ 

å°əŭ     ß—
Å  Ŭ      ¯

   ĸ×     

Not sure if there is any missing keys for third and fourth levels for the keyboard layout dvorak_intl, since I am not used to typing at these levels.

Make layout persistent

The setxkbmap command by itself is effective for current session only. However, it is possible to add the following command to startup applications in respective desktop environment.

setxkbmap LAYOUTNAME

So that the LAYOUTNAME will be set up every time the user logs into the system and the desktop session is started. Log out and log in again, then open Terminal and run setxkbmap -query to verify that new keyboard layout has been applied for every sessions.

Configure for non-Debian system

Should the system upgrade overwrites the configuration file in /usr/share/X11/xkb/symbols, then user may relocate the layout configuration file at somewhere else–perhaps Home directory–and remove from system directory to be sure.

$ mkdir -p ~/.xkb/symbols  
$ cp /usr/share/X11/xkb/symbols/dvorak_intl ~/.xkb/symbols  
$ sudo rm -i /usr/share/X11/xkb/symbols/dvorak_intl  

Then load the layout configuration from there, using the command with -I option. It works similarly.

$ setxkbmap -I ~/.xkb dvorak_intl
$ setxkbmap -query
rules:      evdev
model:      pc105
layout:     dvorak_intl

So instead of setxkbmap LAYOUTNAME, add setxkbmap -I ~/.xkb LAYOUTNAME to startup application in respective desktop environment to load the keyboard configuration for every sessions.

Discrepancy in Debian

If the command returns “Error loading new keyboard description” message (as described by this older post on Unix.SE), then use the following command instead.

$ setxkbmap -I ~/.xkb dvorak_intl -print | xkbcomp -I$HOME/.xkb - $DISPLAY
Warning:          Type "ONE_LEVEL" has 1 levels, but <RALT> has 2 symbols
                  Ignoring extra symbols
Warning:          Key <OUTP> not found in evdev+aliases(qwerty) keycodes
                  Symbols ignored
...
Warning:          No symbols defined for <I253> (keycode 253)

Strangely, the last command returns many warning messages that may be related to my foreign keyboard model (Japanese OADG 109A keyboard layout variant). Also, the changes won’t be reflected in setxkbmap -query but works as expected when typed.

Tested using setxkbmap 1.3.0 in Xubuntu 14.04 (Xfce 4.10), Debian Xfce 8 (Xfce 4.10) and Debian 8.7 Gnome 3.14.

Disclaimer: This answer is intended to show how to use XKB to install and set new keyboard layout. The original instruction was found from the workman/xorg repository, which mentioned both legacy path and current path (for Ubuntu 10.04, GNOME 2.30 back then). However, the instruction has been tested valid for non-GNOME environment i.e. Xfce as well.

The dated instructions provided in dvorak_intl file was most likely intended for older releases of GNOME and no longer valid for modern distributions we use today. While legacy path is found at /etc/X11/xkb/symbols/, the current path is found at /usr/share/X11/xkb/symbols/.

The AltGr key refers to the compose key. It is not assigned by default (at least in Xfce) or usually Right Alt key, depending on Linux distribution in use. While I have enabled compose key to demonstrate the third and fourth level keys, the setup for the compose key is not shown above.

Attribution
Source : Link , Question Author : Léo Léopold Hertz 준영 , Answer Author :
6 revs, 2 users 99%user125388

Leave a Comment