carpalx - keyboard layout optimizer - save your carpals
Carpalx optimizes keyboard layouts to create ones that require less effort and significantly reduced carpal strain!

Have ideas? Tell me.

the best layout

Partially optimized QWKRFY and fully optimized QGMLWY layouts are the last word in easier typing.

the worst layout

A fully anti-optimized TNWMLC layout is a joke and a nightmare. It's also the only keyboard layout that has its own fashion line.

download and explore

Download keyboard layouts, or run the code yourself to explore new layouts. Carpalx is licensed under CC BY-NC-SA 4.0.


Download and install the layouts.

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.