michael orlitzky

emacs-keys

get it

Release
emacs-keys-0.0.3.tar.xz
Browse source
gitweb
Clone it
git clone https://gitweb.michael.orlitzky.com/emacs-keys.git

What is it?

Files that can be used to alter your keyboard layout in the system console, within X.org, or anywhere else that uses xkb (for example, most Wayland compositors):

In other words, we put those keys where they lived on the space-cadet keyboard. This makes emacs (and any readline-based application) easier to use, I promise.

(The console map probably only works on i386 qwerty keyboards, because that's all I have.)

The files:

Installation

The build system installs each of these files to $(datadir)/emacs-keys. The console.map and Xmodmap files can be loaded directly from that location; for example,

user $ loadkeys /path/to/console.map

user $ xmodmap /path/to/Xmodmap

But you probably don't want to do that every time you log in.

Xmodmap

For the Xmodmap file, you would typically add something like the following to your ~/.xinitrc,

emacsmodmap=/usr/share/emacs-keys/Xmodmap
if [ -f $emacsmodmap ]; then
  xmodmap $emacsmodmap
  xmodmap $emacsmodmap
fi

The call to xmodmap doesn't work unless you do it twice, and don't ask me why.

console.map

If you're lucky enough to use OpenRC, the console map can be loaded automatically. OpenRC starts a keymaps service at boot time. The configuration file for that service is usually located at /etc/conf.d/keymaps, and if you set, for example,

extended_keymaps="/usr/share/emacs-keys/console.map"

in there, then OpenRC will load the emacs keymap on top of your default one when the system boots.

Systemd can probably do this too, but you're on your own there.

xkb

The xkb layout needs to be installed where libxkbcommon will look for it. Rather than muck with system paths, we assume that you'll be configuring the keyboard for only one user (i.e. you). The per-user xkb configuration typically goes in $XDG_CONFIG_HOME/xkb, and the variable $XDG_CONFIG_HOME defaults to ~/.config in your home directory. Your ultimate goal is therefore to make the xkb/symbol/emacs-keys file available under ~/.config.

The best way to do this is with a symlink:

user $ ln -s /usr/share/emacs-keys/xkb/ ~/.config/

Now, to use it, all you have to do is tell whatever program you're using to use the emacs-keys xkb layout. For example, the Sway window manager can be configured with,

input type:keyboard {
  xkb_layout "emacs-keys"
}

Other programs are configured similarly.