Genera Xquartz Keyboard

It has taken some effort, but I finally created a reasonable (and close-to-default) keyboard layout and mapping for Genera for using a modern, 87-key "tenkeyless" keyboard under Xquartz. I became reasonably familiar (at a reading level) with Flavors and Genera's X implementation while reverse engineering all this stuff. I also used the apropos function a lot, of course.

This layout stays very close to the default one provided by Genera while adding a few tweaks such as:

  • Improved modifier mappings
  • Calling RUBOUT for Backspace/Delete
  • Ability to use the Keyboard Control activity to further remap things visually

I also created a patch file that will fix an X-Windows bug in Genera with a modern X server when it tries to set the modifier mappings. This will show up in the Genera herald so you know it's there.

The keyboard layout is called :xquartz-87-tenkeyless and nicely printed as Xquartz 87-key Tenkeyless. A keyboard reference is available.


Xquartz must be configured with these three checkboxes set: (others are at your discretion)

You need to allow remote connections, so be sure to do something like xhost + in your xterm window.

Furthermore, you should put the Genera fonts into your X11 font path as described here or things will look "wrong" and be less enjoyable.

One note: There seems to be only 6-key rollover when using the Key Test feature of Keyboard Control. I'm not sure if this is an Xquartz limitation or Genera limitation, or something else. Regardless, it's sufficient for our needs. (Shift-hyper-meta-super-control-X anyone? Can't add symbol in there... )


To use the keyboard layout in Genera:

  • Download the XLib patch file and Keyboard Mapping file from my GitHub repo
    • Warning: these contain non-ASCII/Unicode characters in them (Genera symbol characters)
  • Load File xlib-patch.lisp
  • Load File xquartz-87.lisp
  • Save World ... and update your boot file
  • Restart Genera
  • Start your Xquartz Server and configure as above
  • Start X Screen INTERNET| ... on your host IP or hostname (if configured in your Namespace)
  • Show X Keyboard Mapping will confirm that this mapping is in use by saying The keyboard layout type is :XQUARTZ-87-TENKEYLESS.
    • If not, see below
  • Show Keyboard Layout will show details on the layout
  • Select Activity Keyboard Control will let you remap things further to your hearts content, then put on the kill ring the modifications for your lismp-init.lisp file.

If your keyboard isn't working, it's probably because Genera couldn't match it. One thing to try is this:

Command: sys:*consoles*  
(#<X-SCREEN::X-CONSOLE NEON:0.0 0 (Genera on ARGON) 140001042> #<MTB:MAC-RPC-MAIN-CONSOLE 140005535>)
Command: (xlib:display-vendor (x-screen::x-console-display (car sys:*consoles*)))  
"The X.Org Foundation"

Then, edit the xquartz-87.lisp file to match, in the signature:

(x-screen:define-keyboard-signature :xquartz-87-tenkeyless
  (:keycode-offset 8
   :vendor-name "The X.Org Foundation"
   :vendor-version 11803000)

After that, check the keys against the output of your xmodmap -pk to make sure they match. If not, you'll have to edit almost everything else. (xmodmap will start with ...KeyCodes range from 8 to... - that's where the :keycode-offset comes from.)

Forcing the Keyboard Mapping to Be Used

UPDATE: I cobbled together the Set X Keyboard Mapping for Genera 8.3 from a few pieces I found on the Internet. Load set-x-kb-map.lisp into your world (save it if you want the command permanently) and then you can say Set X Keyboard Mapping [screen] Xquartz-87-Tenkeyless and it will load this mapping.

Note about F14 and F15

F14 and F15 are usually set to lower and raise brightness on the Mac. Disable this in System Preferences -> Keyboard -> Shortcuts -> Display

Next Steps

I'm going to make an improved layout that better utilizes the keys and puts the most frequently accessed ones closer to the home key. Having SELECT on the esc key is also nice (and familiar from using the MacIvory on the console). I'll share that here later.


Here are some screenshots of the keyboard in use on my iMac from the MacIvory III.

:xquartz-87-tenkeyless keyboard mapping - layout and mapping :xquartz-87-tenkeyless keyboard mapping - regular and shifted :xquartz-87-tenkeyless keyboard mapping - symbols :xquartz-87-tenkeyless keyboard mapping - keycodes :xquartz-87-tenkeyless keyboard mapping - keyboard control :xquartz-87-tenkeyless keyboard mapping - typing test 1 :xquartz-87-tenkeyless keyboard mapping - typing test 2 :xquartz-87-tenkeyless keyboard mapping - set x keyboard mapping

Douglas Fields

Writing LISP and Haskell since 1990