carpalx - keyboard layout optimizer - save your carpals

Carpalx optimizes keyboard layouts to create ones that require less effort and significantly reduced carpal strain!

Download keyboard layouts, or run the code yourself to explore new layouts.

X11 layouts are available! Patches to include Carpalx layouts in xkeyboard-config and kbd have been submitted by Perry Thompson. Meanwhile, many thanks to Sven Hallberg for providing X11 configuration for Carpalx layouts. Richard Gomes contributed an archive of these files for KDE/Gnome users.

Love your coworkers? Switch them to QWKRFY layout or a fully optimized QGMLWY layout.

Hate your coworkers? Switch them to TNWMLC layout. It's the only keyboard layout that has its own fashion line.

Have ideas? Tell me.

25/may/18 — The BBC article Why we can't give up this off way of typing by Tim McDonald discusses the history and persistence of QWERTY and my Carpalx work.

16/aug/16 — Ergonomic Keyboard Layout Designed for the Filipino Language at AHFE2016 derives layout for Filipino language using Carpalx

18/apr/16 — Carpalx layouts soon to appear in freedesktop (package xkeyboard-config) and kbd. Thanks to Perry Thompson.

9/sep/14 — A new layout—De Correspondent—for the Dutch language in collaboration with De Correspondent.

16/may/14 — Added evaluation of the Norman layout. This layout modifies 14/26 keys and has statistics similar to Colemak. Detailed statistics are available.

12/feb/14 — Added evaluation of the abKey layout. Its alphabetic layout makes no attempt at ergonomics. Detailed statistics are available.

Installing Carpalx

configuration file : etc/tutorial-00.conf
output : out/tutorials/00


Let's skip the configuration details for now, and see whether things work.

First, change the first line of bin/carpalx if you want to use a specific perl binary. Otherwise, the perl binary in your path will be used.

#!/usr/bin/env perl

Now you should be able to check that you can see the manpage.

bin/carpalx -man

If you get an error of this type

Can't locate Set/ in @INC (@INC contains: /home/martink/perl/5.8.7/lib/5.8.7/i686-linux-ld 
/home/martink/perl/5.8.7/lib/5.8.7 /home/martink/perl/5.8.7/lib/site_perl/5.8.7/i686-linux-ld 
/home/martink/perl/5.8.7/lib/site_perl/5.8.7 /home/martink/perl/5.8.7/lib/site_perl .) 
at bin/carpalx line 163.
BEGIN failed--compilation aborted at bin/carpalx line 163.

then you do not have the module Set::IntSpan (or whatever carpalx complains about) in your module path. Possibly, you do not have the module installed.

To install a module try using CPAN first. Here make sure you're using the perl binary that will be used to run carpalx (e.g. /usr/bin/perl).

> /usr/bin/perl -MCPAN -e shell

cpan> install Set::IntSpan
cpan> quit

If you have the module installed but need to add its path to the module path so that Perl can find it, you can either

  • add -I/path/to/module flag to the first line of carpalx (e.g. #!/usr/bin/perl -I/path/to/module)
  • add path to PERL5LIB environment variable
  • add use lib "/path/to/module" in carpalx, right after the "use strict" line.

quick and dirty optimization

Assuming you can see the manpage, try running a fast optimization of QWERTY over 100 iterations.

> bin/carpalx -conf etc/tutorial-00.conf > out/tutorials/00/out.txt

I've redirected the output to out/tutorials/00/out.txt for review. This output will contain the effort summary of the initial keyboard state (QWERTY), reports for each iteration, and the effort summary of the final optimized state. The contents of the output will be the results of the steps carried out in the 'action' parameter. For this tutorial, the action parameter was

action  = loadkeyboard,loadtriads,

Output files (keyboard images and final configuration) will be written to out/tutorials/00, as controlled by the keyboard_output and pngfiles_* parameters. The files will be marked with a random 6 character string to avoid overwriting previous output (defined by the dynamically assigned runid parameter in the configuration file).

In my case, I obtain the following optimization after 100 iterations. The effort of the final layout is 1.899, which is significantly lower than the effort of the initial QWERTY state (2.962). In other words, significant improvement has already been made in a very short simulation.

# out/tutorials/00/tmp-phpzca.conf

iter               = 100
effort             = 2.16825701504727372
deffort            = 0.405960215518077932
update_count       = 54
t                  = 0.000453999297624848515

t0                 = 10
k                  = 10
maxswaps           = 2
p0                 = 1
action             = minimize
iterations         = 100
onestep            = 0
minswaps           = 1

<row 1>
keys = `~ 1! 2@ 3\# 4$ 5% 6^ 7& 8* 9( 0) -_ =+
fingers  = 0 1 1 2 3 3 3 6 7 7 8 9 9
<row 2>
keys = b q n r g m s f x y [{ ]} \|
fingers  = 0 1 2 3 3 6 6 7 8 9 9 9 9
<row 3>
keys = d h e t l o u i a ;: '"
fingers  = 0 1 2 3 3 6 6 7 8 9 9
<row 4>
keys = j z c w p v k ,< .> /?
fingers  = 0 1 2 3 3 6 6 7 8 9

If you run carpalx again with the same command, you'll find that a different set of files was written to out/tutorials/00. You can run the simulation many times (and on multiple cores or CPUs) and not worry that the output files will clobber one another (while it's possible, it's very unlikely).

The output keyboard file (tmp-phpzca.conf above) can be used as an input file to continue the optimization.