Going mouseless

A few months ago the trackpad in my work computer stopped working properly. Instead of getting it fixed, I took it as challenge to stop using the mouse entirely. Here are the things I learned and rediscovered.

Out of the box

You can go pretty far without a mouse using a combination of Tab, Shift+Tab and arrow keys.

For web browsers, accessible websites such as Google and Wikipedia have focus states for interactive elements and some even contain Jump to navigation, Jump to main content tab-accessible links as the very first things you can tab-navigate to. Page Up, Page Down, Home and End can be used to scroll through web pages and PDF documents. To follow text links, press Ctrl+F, type part of the link text until it matches, press Esc and your link will be focused. Then just press Enter. This can also come in handy for image links and forms: search for a term close to the image or element you want to click or focus on then tab-navigate to it.

For GUI applications in general, on Windows and Linux pressing Alt on will open and/or focus on the applications menu bars. You can then navigate using the arrow keys and pressing the underlined letters in the menu bar items. Good for discovering keyboard shortcuts, too.

Vimium

With the Vimium extension installed, pressing f will make every visible link on the page get a one-to-three letter shortcut. Type that shortcut, navigate to that page.

Besides being faster than tab-based navigation, it can be useful during pair-programming sessions: press f and your coworker can simply say out loud the letter sequence of the link he wants you to navigate to.

Similar ideas in the programming tools space are easymotion and avy.

Keyboard-driven cursor movement

Not all applications support a good keyboard-only experience. No problem. While controlling a virtual keyboard with a mouse is hardly joyful, controlling the cursor with your keyboard makes you look pretty cool.

numpad

The 4862 keys are for moving left, up, right and down respectively. 7913 move diagonally. 5 clicks.

To set this up on a Linux with Xorg, run setxkbmap -option keypad:pointerkeys in a terminal then press Shift + Num Lock to make your numeric keypad control the cursor. For more details, check out the LinuxReviews wiki.

On Windows, as things are always changing in the Control Panel World, refer to the Windows documentation.

keynav

While the numpad approach works well, it can be a bit slow. keynav applies the binary space partitioning idea to mouse navigation. From the keynav website:

You select a piece of the screen. The screen is initially wholely selected. One move will cut that region by half. A move is a direction: up, down, left, and right.

Once you’re done moving, you simply indicate (with a key stroke) that you want to move. Boom, cursor moves.

In practice, this is done by starting the keynav process, pressing Ctrl-; to pop up an overlay and then repeatedly pressing either hjkl for dividing up the screen, w for moving the cursor to the center of the selection area and 1, 2 or 3 for left, middle or right clicking.

Sounds crazy, works pretty well.

Besides being potentially much faster than numpad navigation, Vimium on a Raspberry Pi can take a few seconds to set up all shortcuts depending on how busy a web page is. keynav feedback is always instantaneous.

While the project is Linux-only, I wrote a tiny version of keynav for Windows using AutoHotKey as suggested by the keynav docs. Get it here.

Try it out now

This blog post contains toy implementations of Vimium and keynav.

; opens the keynav overlay. Bisect with hjkl, click a link with 1. Press ; again to recenter. Press q to cancel.

f opens the Vimium overlay. Press the key for the link to navigate or q to cancel.

Why?

As of August 2021, I have been using Vimium for seven years and keynav for six months. I don't miss having a mouse or trackpad!