6

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

  • 1
    I am using us dvorak, with compose key on the |\ (on the querty), the one to the right of the left shift key. This works well for be, however I only type a little of these characters, but also want to type other unicode characters. For example «compose» o " gives ö, or «compose» : ) gives ☺. – ctrl-alt-delor May 17 '17 at 20:27
3
+100

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.

How to install new layout

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

$ 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 default permission is 644.

$ 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

How to set new layout

Before making changes, run setxkbmap -query to check the current layout in case we want to revert the changes later. Most users will use English US keyboard layout 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 is 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 is made 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 i.e. dvorak_intl, since I am not used to typing at these levels.

Make it 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.

Loading local config in 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 i.e. 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.

  • 1
    This may not provide full answer to what OP want, but at least dvorak_intl file has been tested usable and the overwritten config could be avoided by relocating to somewhere else and read using setxkbmap -I DIR LAYOUTNAME command. – clearkimura May 16 '17 at 5:17
  • It works! After restart, you have to choose the new keyboard manually :) it appeared there! Thank you! Please, see the body for the history. – Léo Léopold Hertz 준영 May 17 '17 at 19:14
  • 1
    I rewarded you the bounty because the change lasts over the restart after the manual change in Region & Language. A terminal command for that would also be great. - - Tested on two laptops in Debian 8.7 and Gnome 3.14. – Léo Léopold Hertz 준영 May 17 '17 at 19:32
  • 1
    The command line equivalent to configure "Input Sources" would be gsettings, but this may not be used (at least in Debian Xfce) in environment that has low-level configuration system i.e. xfconf in Xfce, dconf in GNOME. – clearkimura May 18 '17 at 4:27
  • 1
    Run gsettings get org.gnome.desktop.input-sources sources and see if any layout is listed inside []. If there is any, then you may use gsettings, else I'd suggest to use dconf in GNOME. Different distribution may configure differently, like this old post on Unix.SE (unanswered to this date). – clearkimura May 18 '17 at 4:37
2

I have tried a long time ago to make package for a custom keyboard layout. Here the option i could find at that time:

  1. Modify original layout (ex: /usr/share/X11/xkb/symbols/us)

    Issues:

    • It got overwritten on xkb-data update. Package name may differ from distribution to another.
    • Bad idea to create a debian package that overwrites another package file.
  2. Add new layout with different name xy like in this post

    Issues:

    • Same issues of previous method but with layout declaration file: /usr/share/X11/xkb/rules/evdev.xml that need to be modified. AFAIK, Xorg server does not support dynamic loading for new layouts.

The above methods relay on XIM (Standard X input method), a legacy system. I would recommend using a modern input method that support plug-ins (modular design) like IBus or SCIM.

I didn't try that but I expect ibus-table is the easiest way to go like as explain in this post. The added file could be packaged and installed separately like most IBus engines & layouts, IBus take care to loading them.

Update:

Well, this answer on AskUbuntu mentions a cleaner way to modify the upstream package. Here are the minimum instructions to rebuild the package

  1. Enable the source code for repository
  2. Download build dependencies

    sudo apt build-dep  xkb-data
    
  3. Download the source

    mkdir sandbox
    cd sandbox
    apt source xkb-data
    
  4. Create new quilt patch following Ubuntu packaging guide

    cd xkeyboard-config*/
    quilt new username_custom_layout.diff
    quilt add symbols/us
    

    Make your needed modification on symbols/us then

    quilt refresh
    
  5. Build the unsigned source & binary package

    debuild -us -uc 
    
  • 1
    Yeah, basically a debian package just files that should be placed in the correct path. I am interested too in this matter, I will try it and update my answer with my findings. – user.dz Feb 24 '17 at 9:39
  • Please, let me know if you get anything done. I am interesting how to do it. - - It would be great to maintain international dvorak with deadkeys in Linux. – Léo Léopold Hertz 준영 Feb 24 '17 at 9:40
  • 1
    @LéoLéopoldHertz준영, Some one just mention another approach askubuntu.com/a/901356/26246 which seems good, creating a modified package from the upstream one. – user.dz Apr 10 '17 at 23:28
  • 1
    @LéoLéopoldHertz준영 I just added the minimum instructiosn to get you on the path, Debian packaging is quite board to make a complete resume here. – user.dz Apr 11 '17 at 21:39
  • 1
    Please, see unix.stackexchange.com/a/364644/16920 Almost there. What do you think? – Léo Léopold Hertz 준영 May 12 '17 at 13:31
1

Example of a custom Dvorak keyboard layout called Dvorak International Extended which has the features requested here and completed for Windows and Linux (code here) in the post Dvorak international extended keyboard layout - Adding international support for the Dvorak Simplified Keyboard.

Fig. 1 Design of the Dvorak International Extended keyboard layout, Fig. 2 Searching Dvorak in Debian keyboard settings after the changes of Section Installation attempt in Debian 8.7, Fig. 3 Searching extended ...

enter image description here enter image description here enter image description here

Installation attempt in Debian 8.7

I managed to complete the first two steps by the installation instructions, but failing to see the effect of addition of the keyboard layout there

  1. [done] Copy this file to your /etc/X11/xkb/symbols/pc directory. You may need root privileges to do so.

    sudo mkdir -p /etc/X11/xkb/symbols/pc
    sudo cp dvorak_int /etc/X11/xkb/symbols/pc/
    
  2. Add the following line to /etc/X11/xkb/rules/xfree86.lst: dvorak_intl Dvorak international extended

     sudo touch /etc/X11/xkb/rules/xfree86.lst
     sudo echo `dvorak_intl Dvorak international extended` >> /etc/X11/xkb/rules/xfree86.lst
    
  3. However, I cannot complete the third step

    // In order to make the keyboard layout available in GNOME,
    // you should also modify /etc/X11/xkb/rules/xfree86.xml
    // accordingly (this is an XML file and the format is mostly
    // self-explanatory).
    

    The command apt search XF86Config returns nothing because my system does not have the file /etc/X11/xkb/rules/xfree86.xml. There is a typo in instructions (Thank You, clearkimura)! Search the filename and edit it with the following, but still I am not sure what to fill there exactly - filename of the file or dvorak-intl-extended (my custom name)

    masi@masi:~$ dpkg --search xfree86.xml
    xkb-data: /usr/share/X11/xkb/rules/xfree86.xml
    
    masi@masi:~$ sudo vim /usr/share/X11/xkb/rules/xfree86.xml 
    

    Addition in /usr/share/X11/xkb/rules/xfree86.xml

        <variant>
          <configItem>
            <name>dvorak-intl-extended</name>
            <description>English (Dvorak, international extended with dead keys)</description>
          </configItem>
        </variant>
        <variant>
    

    I restart the system but unsuccessful outputs in Language Keyboard menu in Fig. 2 and Fig. 3.

    Maybe, something wrong with my permissions

     masi@masi:~$ sudo ls -la /etc/X11/xkb/symbols/pc/
     total 12
     drwxr-xr-x 2 root root 4096 May 13 20:35 .
     drwxr-xr-x 3 root root 4096 May 12 16:25 ..
     -rw-r--r-- 1 root root 2989 May 12 16:26 dvorak_intl
    

    Directory permissions there should be fine

    masi@masi:~$ ls -la /etc/ | grep X11
    drwxr-xr-x  10 root root     4096 Sep  8  2016 X11
    masi@masi:~$ ls -la /etc/X11/ | grep xkb
    drwxr-xr-x   4 root root  4096 May 12 16:25 xkb
    masi@masi:~$ ls -la /etc/X11/xkb/ | grep symbols
    drwxr-xr-x  3 root root 4096 May 12 16:25 symbols
    masi@masi:~$ ls -la /etc/X11/xkb/symbols/ | grep pc
    drwxr-xr-x 2 root root 4096 May 13 20:35 pc
    

What should the permission be of the new keyboard layout?

OS: Debian 8.7

  • 2
    Um, dpkg --search xfree86.xml does return result in Ubuntu 14.04 and so do Debian 8. It is provided by xkb-data: /usr/share/X11/xkb/rules/xfree86.xml. The path was different though. – clearkimura May 13 '17 at 17:15
  • @clearkimura Thank you! Please, see my addition. I do not know what to exactly add to the file. – Léo Léopold Hertz 준영 May 13 '17 at 17:25
  • 1
    I think something is off with the dated instruction in 2007. Don't most distro today run X.org instead of XFree86 server? In fact, I haven't seen any solution or tutorial that asks to edit xfree86 files to setup a new keyboard layout. – clearkimura May 13 '17 at 18:06
  • 1
    @LéoLéopoldHertz준영 After continuing my research on "how to setup new keyboard layout using xkb", I managed to install several layouts. Still testing whether it is persistent or not. I might post an answer soon. – clearkimura May 14 '17 at 17:49
  • 1
    xfree86 rules are no longer used in modern XKB. you'll want to modify evdev, evdev.lst and evdev.xml instead. (you'd modify the base templates if you're creating a patch per askubuntu.com/a/901356/669043). – quixotic May 15 '17 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.