Skip to content

ryanprior/home-row-control

Repository files navigation

Home Row Control

If you use a shortcut keys with Ctrl often, you can create a more ergonomic layout by using Caps Lock and Enter, two big keys in the home row, as Ctrl modifiers.

You need not give up on the key behavior you are used to: Enter and Caps Lock will act as usual when you strike them a single time, or like Ctrl when held down as a modifier for other keys.

Supported platforms

Home Row Control uses X11, which means no native Windows or Mac support.

(help wanted to support other platforms! see bugs #1 and #2)

Dependencies

  • Xcape
  • xmodmap (from x11-server-utils)
  • posix sh (eg. dash)
  • optionally systemd, to run automatically when you start your X session

(help wanted to support auto-start for other init systems! see bug #8)

Installing

You can find binary packages (deb, rpm, and tar) plus a self-executing .sh installer in releases.

After installing, run systemctl --user start home-row-control.

Usage

Run _home_row_control to activate for the current session. Optionally, set up your system to run that command automatically on login.

Detailed explanation of effects

  1. Enter is reassigned to Hyper which should have no effect in most contexts. When you press Enter, the system sees a key up and key down event corresponding to Hyper and also applies the same modifier as if a Control were held down.

    If you tap it briefly (<1 second) without pressing other keys between press and release, it will trigger the normal Enter behavior. This means the key press will not register immediately when you press, but will instead come a fraction of a second later upon release.

  2. Caps Lock is reassigned to Right Control. When you press Caps Lock the system sees a key up and key down event corresponding to Right Control and applies its modifier.

    If you tap either Caps Lock or Right Control briefly (<1 second) without pressing any other keys between press and release, it will trigger the normal Caps Lock behavior.

    I chose to use Right Control this way because X11 apparently doesn't recognize separate left- and right- Hyper keys. If you know of a better option that does not change the behavior of the normal control keys at all, please let me know.

Troubleshooting

Sometimes the system seems to lose the keymap. If you're using systemd you can reset like so:

$ systemctl --user restart home-row-control

Otherwise you can serach for the home-row-control xcape process and kill it, then run _home_row_control again.

Useful fact

It might be helpful to know that Ctrl+m replicates the effect of the Enter key when it's temporarily disabled during a home-row-control outage. I would like to know how to make it more resillient, if you have ideas please propose them!

Building packages

You can use the included package script to build your own packages. The packaging dependencies are:

  • ruby
  • fpm (installed as a ruby gem)
  • bash
  • debuild and rpmbuild

Running the packaging script

  1. in the project directory, run bundle install
  2. run bundle exec ./package