Keyboard setup on Linux

Using Dyalog under 'nixes

Keyboard setup on Linux

Postby AndyS|Dyalog on Tue Sep 21, 2010 12:22 pm

This post will be updated in future with details of more Linuxes ..

Diagrams of location of the APL characters on the keyboard can be found at http://dfns.dyalog.com/n_keyboards.htm.

[Edited by Jason/Andy...]

[2016-12-06]
Both the /usr/bin/dyalog and $DYALOG/mapl scripts for 14.0 onwards now accept the "-kbd" paramter. This calls $DYALOG/aplkeys.sh which should allow you to input APL characters. $DYALOG/aplkeys.sh needs to be called only once in each desktop instance, once X has started. This applies to RIDE clients running on Linux too.

Ubuntu 13.10
Ubuntu have once again changed their keyboard management. We are still (as of 2013-12-20) working on full support, but for now, here is a workaround:

Create a script, called aplkeys.sh, to contain the following code:
Code: Select all
#!/bin/bash

if [ "$DISPLAY" >> /dev/null ]
then
        ## We are running Xorg
        if ! [ `setxkbmap -query | awk '/layout/ {print $2}' | grep "apl"` ]
        then
                ## We have no APL layout - so lets set one up - we're going to use the Windows Key.
                ## Setup keyboard map
                XKBRULES=`setxkbmap -query | awk '/rules/ {print $2}'` 2>/dev/null
                XKBMODEL=`setxkbmap -query | awk '/model/ {print $2}'` 2>/dev/null
                XKBLAYOUT=`setxkbmap -query | awk '/layout/ {print $2}'` 2>/dev/null
                XKBVARIANT=`setxkbmap -query | awk '/variant/ {print $2}'` 2>/dev/null
                XKBOPTIONS=`setxkbmap -query | awk '/options/ {print $2}'` 2>/dev/null
                setxkbmap -rules ${XKBRULES} -model ${XKBMODEL} -layout "${XKBLAYOUT},apl" \
                        -variant "${XKBVARIANT},dyalog" \
                        -option "${XKBOPTIONS},grp:win_switch" 2>/dev/null
        fi
fi

This script needs to be run each time you log on to Ubuntu (not each time you open a terminal window).
The script assumes that you have only one language (other than APL) installed. Note that in non-US environments the US keyboard may still be defined: in which case, replace -layout "${XKBLAYOUT},apl" with -layout "uk,apl" (replace uk with your language).

Ubuntu 12.04-13.04, Fedora 17 onwards, openSUSE 12.2 onwards & LinuxMint 15 you already have the keyboard installed
There is perhaps other distributions that include this too, however currently they are currently unconfirmed.
    KDE - In KDE you can choose the language "APL" with the 'dyalog' Variant and select your "Shortcut for Switching layout" in the input settings → Keyboard
    Gnome3/Unity - In Gnome3 or Unity by default you won't be able to see the "APL" Language, this is due to a feature in Gnome-Control-Center.
    Running the following command will allow Gnome-Control-Center → Keyboard layout show the "APL" language:

          gsettings set org.gnome.libgnomekbd.desktop load-extra-items true

    Once you've run this from a command line you will be able to add the "APL" language (dyalog variant) to your keyboard settings, after which you should click "Options" and select "Key(s) to change layout" selecting a "While Pressed" key. Note that you can search for "dyalog" in the list of keyboard layouts.

Ubuntu 11.x
Follow the instructions for Ubuntu 10.04. However, both Unity and Gnome3 reserve the Windows keys for their own purposes, and it's not clear how you might reassign them. It will therefore be necessary to associate a different metakey with the mode swap to APL .. either one of the Control keys or the Alt key seems best ..

Ubuntu 10.04
Use
      sudo dpkg --install dyalog-keyboards.deb
to install the keyboard support.

Then for each user select System->Preferences->Keyboard->Layouts->Options:
      Select Dyalog APL symbols in group 2 in the Dyalog APL options section.
Select your preferred key to get the APL characters in the Key(s) to change layout section.
Dyalog recommends either Any Win key (while pressed) or Left Win (while pressed)

You may need to Reset to Defaults and try again if you find that this process results in you getting APL characters when you're expecting normal characters; the normal characters can be obtained by holding down the key which you have chosen to use to get APL characters. Don't forget this if your screen lock kicks in !

Centos5/RHEL5
Use
      sudo rpm -Uvh dyalog-keyboards.rpm
to install the keyboard support.

Then for each user select System->Preferences->Keyboard->
      Layouts:
Add APL to the list of layouts, ensuring that it is the second in the list
Layout Options-> Group Shift/Lock Behaviour:
Select your preferred key to get the APL characters in the Key(s) to change layout section.
Dyalog recommends either Any Win key (while pressed) or Left Win (while pressed)


openSUSE 11.3 with KDE4.4
It appears that the default settings for terminal windows grab the Windows key for the terminal's own purposes, so you cannot get some APL characters, and cannot use the edit/trace commands associated with the Enter key. This will be updated in due course.
User avatar
AndyS|Dyalog
 
Posts: 157
Joined: Tue May 12, 2009 6:06 pm

Re: Keyboard setup on Linux

Postby Jason|Dyalog on Fri Oct 21, 2011 1:27 pm

If you are running Ubuntu 11.x with the Unity interface, here's a fix to allow you to use the "Windows Key" as your APL key.

From the Ubuntu Software Center you will need to install Compizconfig Settings Manager. Once you have installed this you can open it up from the Unity applications menu.

Select "Ubuntu Unity Plugin" from the options, and you can then change the "Key to show the launcher" option so that you have your "Windows Key" back (known as "Super" in Linux). Here's a screenshot of the options:

UnityOptions.png


Clicking on the button labelled "<Super>" will bring up a dialogue allowing you to disable the option or change the "hot-key" for this action. I have changed this on my System to be "<ALT>+F1" which is what the menu hot-key was in Ubuntu versions older than 11.x. If you choose to do this, ensure that you change the "hot-key" for "Key to put keyboard-focus on launcher" as this will conflict, I have disabled this feature.

Here's a screenshot of the changed options:

UnityOptionsChanged.png


Once you have done this, you can close the CompizConfig Settings Manager and set your keyboard layout up as before from the System Settings icon on the Unity bar.

After making these changes you may be required to log off and back on for Unity to pick up the changes (I did on one system, and did not on another).

Hope this helps anyone on Ubuntu 11.x running Unity.
Jason|Dyalog
 
Posts: 21
Joined: Tue Sep 09, 2008 2:42 pm

Re: Keyboard setup on Linux

Postby dhdurgee on Fri Dec 02, 2011 5:48 pm

I believe I have installed the linux keyboard correctly on my Linux Mint 11 Katya x64 system and have installed a development build that I downloaded several months ago. This is the first system I have been able to install it on, as my Linux Mint 8 Helena x64 system had too early a release of certain requirements for mapl to run.

I am able to enter the following APL characters using the left windows key as configured:

⋄¨¯<≤=≥>≠∨∧×÷
?⍵∊⍴~↑↓⍳○*←→⊢
⍺⌈⌊_∇∆∘'⎕⍎⍕
⊂⊃∩∪⊥⊤|⍝⍀⌿

I have not been able to deduce how to input any other APL characters! I attempted to download the Dyalog 2007 conference paper on this, but the links are out of date. Is it possible I need a later version? The one I am running identifies itself as:

Dyalog APL/S Version 13.0.7710
Unicode Edition
R-IDE Enabled
Pre-release Development Build

I had my first chance to test this out yesterday and the lack of access to other APL characters made it a frustrating experience.

Dave

PS: I found my answer a little bit ago. It appears that the order you hit the keys makes a difference on my system. If I
hit and hold the Left_Windows_Key and THEN hit and hold the Shift key I get the other characters. If I reverse the order
of this it does NOT select the other APL characters. This will take getting used to.
dhdurgee
 
Posts: 12
Joined: Mon Feb 07, 2011 5:21 pm

Re: Keyboard setup on Linux

Postby Geoff|Dyalog on Mon Dec 05, 2011 2:55 pm

My presentation at the 2007 Dyalog conference (http://conference.dyalog.com/dyalog07/p ... wWorld.pdf) did mention that some keyboard retraining would be required. Pressing the - in your case - left windows key changes the keyboard language layout. After that the shift key affects character choice within that layout.

So, yes, you do have to learn to press the left windows key prior to the shift key.

The benefits are considerable. The keyboard works in all applications (I have logged a bug with Opera for one character which seems to give them problems). It is built on the same technology base as all other multilingual keyboarding. It is true that other environments have designs on the use of the Windows key for other purposes. However, its history in being used for multilingual layout switching means that they have to make that choice soft.

Some may appreciate the bonus of having line drawing characters on the numeric keypad. Try pressing the Left windows key and each of the numeric key pad keys to see what is there. I find myself using these in vi (actually vim) for some internal documentation.

It is also nice to be able to place APL comments in our C code. I do get some negative comments on this from developers using editors that are are not UTF-8 aware but we are clear that this is a good way forward. This is encouraged by the use of this Linux keyboard and by the expectation that the keyboard will work in the same way independent of the application.

There is also a paper I presented to the APL conference in Berlin. It updates the 2007 presentation in the light of some work by Xorg. We will post a link to it here once Andy has got it somewhere sensible. In the meantime - it you want a copy ask for one and I will send you a PDF.

The keyboard is not constrained to be used with Dyalog it can be used with any APL that can be made UTF-8 aware. I use it to run very old (v6.2) versions of Dyalog when support is required.
Geoff|Dyalog
 
Posts: 40
Joined: Wed May 13, 2009 12:36 pm

Re: Keyboard setup on Linux

Postby dhdurgee on Tue Dec 06, 2011 4:47 pm

Thanks for your response and the link to the original presentation. I am definitely interested in your updated paper from Berlin at some point. Now that I have looked through the presentation and inspected the files on my system I am wondering what would be involved if I wanted to "tweak" things a little bit. Is it sufficient to simply make changes to the apl_group2 file, or are other changes required? Would it be possible to add another level using an ALT key in a manner similar to the Danish key used in the example? Is it as simple as "THREE_LEVEL" instead of "TWO_LEVEL" for the key? How about "FOUR_LEVEL" as in the example Danish key?

Dave
dhdurgee
 
Posts: 12
Joined: Mon Feb 07, 2011 5:21 pm

Re: Keyboard setup on Linux

Postby Geoff|Dyalog on Wed Dec 07, 2011 10:22 am

If you extend the layout to three or four levels you are encouraged to add the line

include "level3(ralt_switch)"

There is now much better documentation for xkb than I was able to find in 2007. However, simply looking at the symbols files already defined will give you a lot of clues. They have also simplified the syntax and as people catch up with more modern distributions I will update the files.

The big change since 2007 is that the "gnome" model has become dominant. So adding group2 information is discouraged. Still works but not encouraged.

By placing the information in group1 you get efficient layout switching for up to four layouts. This is because the layouts are loaded as a single keyboard with 4 levels. Not what was initially envisaged by Silicon Graphics but very useful.

Given that you already have a working group2 definition I would stick with it and add THREE_LEVEL and FOUR_LEVEL as required. Add the include line if existing layouts on your machine use it. Have a look at "dk" for instance.

Which distribution are you using?
Geoff|Dyalog
 
Posts: 40
Joined: Wed May 13, 2009 12:36 pm

Re: Keyboard setup on Linux

Postby Geoff|Dyalog on Wed Dec 07, 2011 10:49 am

Useful links:

http://www.x.org/archive/X11R7.5/doc/input/XKB-Enhancing.html#AEN97

http://pascal.tsu.ru/en/xkb/gram-common.html

Most of the work has been done by people who need to use Russian and Ukrainian at the same time. So the English in the documentation can be a little odd. However, I would hate to be trying to write this in Russian so be a bit forgiving.

Dyalog sell keyboards already engraved to match the keyboard file. We are a bit constrained by the Windows implementation so we have not used three or four levels. This is not a constraint imposed by the engraving process. It is imposed by the Windows input method editor which itself is constrained by the restricted nature of the way in which Windows handles shift keys. We do not engrave the line drawing characters but they are so logical as not to require it. The Windows IME has allowed us to implement overstrikes which I have not managed with Xkb. The Xkb concept of "compose" does not extend to generating the APL overstikes - a pity.
Geoff|Dyalog
 
Posts: 40
Joined: Wed May 13, 2009 12:36 pm

Re: Keyboard setup on Linux

Postby Jason|Dyalog on Tue Sep 25, 2012 11:02 am

I have edited the first post here with information about newer versions of Linux and getting the keyboard working.

Jason.
Jason|Dyalog
 
Posts: 21
Joined: Tue Sep 09, 2008 2:42 pm

Re: Keyboard setup on Linux

Postby larry316 on Sat Dec 03, 2016 4:25 pm

Can you help me.I am running Linux Mint 17.3 Rosa on a Toshiba laptop using a Dell Keyboard with an USB connection. I recently downloaded 64 bit Dynalog. It brings up a terminal window, but I have not figured out how to enter APL symbols.
larry316
 
Posts: 16
Joined: Thu Dec 01, 2016 4:28 pm


Return to UNIX and Linux

Who is online

Users browsing this forum: No registered users and 1 guest