6

I'm using Karabiner on Mac OS X to make some of my keys work as half modifiers: for ex. tapping enter is enter but holding it is meta. Is it easy to do the same in Linux?

PS. I mean: I want to be able to use enter both as a modifier key and as enter, depending on whether it is held or pressed and released. (Not the same as sticky keys.)

Sparhawk
  • 19,941
Toothrot
  • 3,435
  • I don't know of any way to do that particular type of trick in Linux, but there are a whole lot of things you can do using tools like xset, xmodmap, and AutoKey. For more than you ever wanted to know, check out https://wiki.archlinux.org/index.php/Keyboard_configuration_in_Xorg – Joe May 28 '16 at 00:25
  • There's not a single simple way that I know of, but I'd look at xmodmap and xkb: https://wiki.archlinux.org/index.php/Xmodmap and https://wiki.archlinux.org/index.php/X_KeyBoard_extension . This isn't being posted as an answer because I am not at a desktop right now to give a thorough and detailed explanation. If these can't do it you may have to start messing with kernel drivers. – Wyatt Ward Jul 19 '16 at 04:24

1 Answers1

1

Two options

I use At Home Modifier to achieve this. The developer also suggests xcape as an alternative.

Comparison

The developer of At Home Modifier says the following about xcape.

Pros: Don't have to recompile for each update of X server or xf86-input-evdev. The code is smaller.

Cons: May not be available for Wayland, since XTest and Record extensions may be dropped. Probably interferes with other softwares which use Record Extension, e.g. AutoKey or xnee.

My experience

I've used both. Personally, I prefer At Home Modifier for a few reasons.

  1. It's very easy to set up At Home Modifier with an xorg.conf rule. Hence, it can apply to specific keyboards, leaving other keyboards alone.
  2. At Home Modifier acts at a system-level, meaning that it works better in multi-user environments (unless you want different settings, in which case xcape might be more appropriate).
  3. At Home Modifier maps the modifier key (e.g. Meta) to the "tapped" key (e.g. Enter), whereas xcape does the opposite. When X isn't running, e.g. on the console or in the display manager, I'd prefer to have access to the "real" fallback key, i.e. Enter. I'd use that much more frequently in these situations.

The first pro of xcape quoted above may or may not affect you, depending on your distro. If you update Ubuntu immediately (I've done this), you may need to recompile At Home Modifier yourself if the ppa lags behind (it's lagged a few months at least once). If you use Arch Linux, the AUR package is up to date and easy enough to bump the version number. The old version is generally compatible anyway.

Sparhawk
  • 19,941