Skip to content

DevLayer is a xmodmap keyboard layout generator/analyzer optimized around programming

Notifications You must be signed in to change notification settings

HenryMarshall/devLayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevLayer

DevLayer is a xmodmap keyboard layout generator that puts frequently used programming keys closer to the homerow. Because it places these keys on the AltGr layer it is compatible with any layout that does not utilize this key (e.g., QWERTY, Dvorak, Colemak, Workman).

If you do rely on the AltGr key to type foreign characters, DevLayer is not for you. It replaces these keys with various programming keys.

Installation and Use

You can get a version of DevLayer customized to your preferences from the configurator. This is the preffered download method. Alternatively, you can download a handful of common defaults from the github page. If you're not sure which file to use, you probably want .qwertyDevLayer.

You can enable the layout with the command xmodmap ~/.qwertyDevLayer (change qwerty to your layout if applicable). To get the layout to load on startup you can add it to your startup scripts in ~/.xinitrc thusly:

if [ -s ~/.qwertyDevLayer ]; then
    xmodmap ~/.qwertyDevLayer
fi

DevLayer is intended to be used by pressing the AltGr key with your right thumb and the corresponding character key. It is recommended that you print out a character map from the configurator and hang it near your keyboard while your learn the new layout.

Why use DevLayer

Much effort has gone into designing key layouts that minimize finger travel and improve comfort when touch typing in English (see the Colemak or Dvorak layouts). In contrast, virtually effort has been spent optimizing keyboards for various programming languages.

In fact, some of the most frequently used keys, including /?;:'"[]{}\|-_+=0), backspace, and enter, are pressed by a single finger. In the following javascript snippet, fully 31% of characters are typed with your overloaded right pinkie on a traditional keyboard:

for (var i = foo.length - 1; i >= 0; i--) {
  if (foo[i] === "foo") { 
    bar++;
  }
}

DevLayer improves load balancing tremendously and vastly reduces consecutive keypresses with the same finger. It does this by using the right alt (AltGr) like a second shift modifier. For example, you may type = by pressing AltGr + l (on a QWERTY keyboard).

DevLayer further puts common letter sequences into convenient finger rolls which makes (){} as easy to type as asdf.

The best part of DevLayer is that it's a no commitment change which coexists with whatever layout you are currently using. This means you can slowly transition to your new key map without losing any of your existing speed. Further, this means you can switch off when pair-programming without having to fiddle with keyboard settings. If you want to jump in head-first and force the change check out the "hardcore" xmodmap files which disable the traditional key inputs (e.g., Shift + 8 for *).

Check out the configurator to test it with your own code snippets and see the reduction in finger travel and consecutive finger use yourself. You can also make tweaks to the layout, like remapping your CapsLock key to Backspace, Control, or Escape before downloading.

Implementation

Physical keys are internally referred to by their Xmodmap keycodes in decimal notation.

A list of these keycodes and the currently associated letters can be obtained by running xmodmap -pke. Here is an image of the keycodes written on their respective keycaps (albeit in hex notation).

A note on various language used throughout the program.

  • keyboard -- An object containing the physicalKeys. Keycodes in decimal notation are used as the keys. Values describe the location of each physical key and the hand and finger it is struck with.
  • .Xmodmap / xmod -- The \n delimited string of keycodes and characters. This uses names for all non alphanumeric symbols (e.g., exclam for '!'). This is the file directly used by the xmodmap software.
  • layout -- An array of objects denoting the keycode, and ascii character for each modLevel (noMod, shift, altGr, altGrShift). Generated from xmod.
  • chords -- Keys are every legal input given a layout. Values are an array of the strokes required to input this key in the easiest way. Many characters can be entered multiple ways with devLayer. Generated from layout.
  • corpus -- The body of text analyzed.
  • corpusStrokes -- Array of arrays containing all physicalKeys that corresponds to the characters of the corpus.

FIXME

  • Resolve magic number in key-width sass mixin.
  • dl.buildCurrentStroke test relies on similar logic as test subject

TODO

  • Handle consecutive spaces.
  • Include a map of DevLayer on the github page.
  • Tests for scoresForXmods and processCorpus.
  • Restore async nature of layout ajax calls.

Long-Term Objectives

About

DevLayer is a xmodmap keyboard layout generator/analyzer optimized around programming

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published