Typing glyphs on Linux


 * This article is specific for Linux. For Hardware and other platforms, see Typing glyphs.

Since mid-2012, most Linux distributions with X11 and Wayland have Dyalog APL keyboard support included with the distribution, using, the X Keyboard Extension.

setxkbmap
The simplest way to set up an APL keyboard on Linux is with the following  command. Enter the following in your terminal emulator of choice:

An explanation:


 * assigns  (U.S. English) to be the primary layout, whereas   is secondary


 * assigns Right Alt to switch to the secondary  layout when it is pressed, otherwise   is used


 * assigns the Dyalog APL variant to the  layout which contains modifiations unique to the Dyalog language (Note the preceding comma)

A full list of keys that can be used to switch layouts is included in  under the   category.

Note:


 * These changes are not permanent; the user will have to select one of a myriad of methods to run the command on startup. Alternatively, if they use one of the desktop environments listed below, they can follow those instructions.


 * If you want to specify a different language, say for United Kingdom, specify  instead of   (not  )


 * If you want to specify a different layout, dvorak, bepo, etc, change the variant flag to.

NixOS
Adding these entries to  will setup xkbmap to work correctly after the next time you build your configuration (usually with  ).

libinput
X11 and Wayland use XKB rules to determine their layout. To set a layout create a file called  at   or , ensuring you have permissions, and edit it to:

The options "us,apl", ",dyalog", and "grp:switch" are the same as in setxkbmap and can be changed to better suit your environment.

Once saved this will affect any future session. To change the current session and test out layouts, use.

GUI

 * 1) Open the Activities menu; this is located in the top-left corner of a default GNOME 3 session (alternatively, use your Super key to open the Activities overlay): Gnome-kbd-setup-1.png
 * 2) Search for "startup." When the Startup Applications program is highlighted, press the Enter key to open it: Gnome-kbd-setup-2.png
 * 3) Select the Add button on the right-hand side: Gnome-kbd-setup-3.png
 * 4) Provide a name, enter your  command, and click Add when finished: Gnome-kbd-setup-4.png

Terminal

 * 1) Navigate to   and create a   with any name that will help you remember its function.
 * 2) Add the following to the contents of your file, customizing to suit your needs:

LXDE

 * 1) Prepend an   to the   command from above:
 * 2) Add it as a line in your user's LXDE   file, located at:

For Lubuntu versions up to and including 18.04 (before the LXQt split), the location of  is.

GUI

 * 1) From your LXQt panel, navigate to Preferences → LXQt Settings → Session Settings; alternatively, enter   in your terminal emulator. You will be greeted with the following window: Lxqt-session-settings.png
 * 2) Select the   dropdown (it will be highlighted as shown above) and click the Add button to display the following pop-up window: Lxqt-add-autostart.png
 * 3) Provide a name, enter your   command, and click OK when finished.

Terminal
The above GUI approach merely creates a  file in the user's. Create your own file in the  directory whose contents are as follows, to replicate the functionality achieved through the GUI:

GUI

 * 1) Open your MATE menu (in the top-left corner of a default environment) and select Control Center at the bottom of the window: Mate-kbb-setup-1.png
 * 2) Scroll down through the main window, and under the Personal category, select Startup Applications: Mate-kbb-setup-2.png
 * 3) Click the Add button on the right-hand side: Mate-kbb-setup-3.png
 * 4) Provide a name, enter your   command, and click Add when finished: Mate-kbb-setup-4.png

Terminal
Navigate to  and create a   with any name that will help you remember its function.

Add the following to the contents of your file, customizing to suit your needs:

Wayland
Currently, Wayland uses XKB for keyboards, but they are not modifiable during runtime using e.g.  by default. The keyboard layout must be configured and then the session restarted.

GNOME Tweaks
The Tweaks tool allows configuration beyond the defaults enabled in GNOME.


 * 1) Install GNOME Tweaks using apt or dnf, or by searching your distribution's Software Center.
 * 2) Start GNOME Tweaks by either:
 * 3) Using a terminal, type   and press Enter.
 * 4) Using the GUI:
 * 5) Open the Activities menu; this is located in the top-left corner of a default GNOME 3 session (alternatively, use your Super key to open the Activities overlay): Gnome-kbd-setup-1.png
 * 6) Search for "Tweaks" GnomeTweaks.png
 * 7) Open Keyboard & Mouse Panel and enable "Show Extended Input Sources" GnomeTweaksKeyboards.png
 * 8) Open the Additional Layout Options and tick one or more of the options under "Switching to another layout" GnomeTweaksKeyboardsAdditional.png
 * 9) Go to Settings → Region & Language → Add a new input source. Both English (United Kingdom) and English (United States) will have several APL layout options to choose from.
 * 10) Restart the session (for example, by logging out and logging in again).

Xfce
Xfce's GUI ( →   →  ) is unable to set up an APL-compatible keyboard. Therefore, we must do it ourselves.

Xfce ships with a utility, xfconf-query, which allows you to manage Xfce's XML configuration files on the command line. Enter the following commands into your terminal:

This enables XKB, allowing us to manage our keyboard layout.

Defines the keyboard layout itself. The comma-delimited  specifies a second layout group. Make sure you replace  with the code for your language; a list of these can be found in , under the   category.

This tells Xfce to switch to the APL layout only when the Windows key is pressed. When the Windows key is released, the layout will return to its previous setting. This is incredibly useful as the  layouts in XKB do not support Space, Enter , or the arrow keys (among basically all the others). A full list of possible keys for switching between keyboard groups is located in, under the   category.

Specifies that the variant applies to the second layout,, due to the preceding comma. The  variant is unique to Dyalog.

And you're done! Try holding down the Windows key and pressing H on your keyboard — you should see a.

xmodmap
Modifying the Linux keyboard to support APL keys via xmodmap(1) is possible, but not recommended — it has been superseded by the X keyboard extension (XKB). Generally  is best for simple tasks, which APL keyboards often tend not to be. Dyalog APL, for example, has native support for XKB.

For users who understand the pitfalls, an example  can be found at this GitHub Gist.

XCompose (backtick/prefix/dead key)
With the prefix key method, one key is assigned as a "dead key". When the dead key is pressed once, there is no output, but subsequent keypresses may produce a character. This is a common method for producing accented characters on certain keyboard layouts.

The following GitHub gists define dead key sequences which produce APL characters using the standard APL key locations.


 * XComposeAPLBacktickUS
 * XComposeAPLBacktickUK

Save the contents of one of the above listed files as. Changes should take effect the next time an application is started.

Gnome catches keystrokes before Dyalog
After upgrading Ubuntu 21.04 (Hirsute Hippo), Gnome catches the keystrokes from the Super key to show the list of applications, before Dyalog can receive it. Changing the shifting key from  to   avoids the issue. Changing it to  does not work.

Dyalog Overrides Current Keyboard Settings
Prior to version 18.2, Dyalog APL would override the current XKB configuration to use the Meta ("Windows") key as the modifier for entering APL symbols. If the user manages their keyboard configuration manually using the techniques described on this page, this behavior can be quite troublesome.

To run Dyalog in the terminal without overriding ("hijacking") the user keyboard configuration, run  with the   option:

The following script can be used to launch RIDE, immediately connecting a new Dyalog instance, without changing the xkb settings:

The keyboard layout changing is done by the file at, so changing it changes the behavior (clearing it entirely stops the automatic keyboard layout switching). Note that the file exists for each installed version and is reset on any update, so it may need to be modified multiple times.

APL Keyboard Remains After Dyalog is Closed
Previous versions of Dyalog override the current keyboard configuration, as described in this section, but even using the default keyboard configuration by starting Dyalog 18.2 or later with

fails to return the user to their previous keyboard configuration on exit. To solve this, create a custom Bash script to save and revert keyboard settings upon exiting Dyalog APL:

Settings reverted during X Windows session
Since at least March 2020 there have been issues with  settings being reset without user instruction under the X Windows System.

Below is a script written in Raku that continuously checks for this undesirable reset behavior and puts the intended settings back in place.