jasonrudolph / keyboard

⌨ Toward a more useful keyboard
MIT License
2.08k stars 211 forks source link

Remove dependency on Karabiner-Elements #38

Closed jasonrudolph closed 6 years ago

jasonrudolph commented 6 years ago

tl;dr - Hyper Mode is now triggered by tapping the option key, and you'll need to use the macOS system preferences if you want to remap caps lock to control.

Motivation

A few times each day, I experience a strange issue where my keyboard stops responding for a few seconds, and then a stream of twenty or so keystrokes occur all at once. I'm not sure what's causing it, and I don't know how to reliably reproduce it (other than just using my Mac for a few hours and waiting for it to happen 😓).

I don't know if it's a bug in Karabiner-Elements, a bug in this repository, or a problematic interaction between my Hammerspoon customizations and Karabiner-Elements. 🤷‍♂️ However, I disabled Karabiner-Elements for a week, and I didn't experience the issue at all. I then re-enabled Karabiner-Elements, and I started seeing the issue again.

Since most of this repository's customization uses Hammerspoon, and I only use Karabiner-Elements for two small(ish) things, I'm making the bittersweet decision to remove Karabiner-Elements.

User-facing changes

Tap option to enter Hyper Mode

I previously used Karabiner-Elements to map the right option key to a "hyper" key. Hammerspoon can't distinguish between the right option key and the left option key, and it wouldn't make sense to override both keys, so we need another approach for triggering Hyper Mode.

With the changes in this pull request, you'll now tap option (AKA alt) to enter Hyper Mode and then press any shortcut to focus the associated application. For example, if you're using the default keybindings to open the Finder, you would:

  1. Tap the option key (i.e., press and then release it in quick succession) to enter Hyper Mode
  2. Then, press f for Finder

With this approach, we avoid interfering with existing macOS shortcuts and application shortcuts that make use of the option key, and we still have a way to define global shortcuts for launching apps.

Use macOS system preferences to remap caps lock to control

I previously used Karabiner-Elements to map caps lock key to control. Hammerspoon can't do that, but it's a quick, one-time change that you can make via macOS system preferences:

Open System Preferences, navigate to Keyboard > Modifier Keys, and set the caps lock key to control [screenshot]

With that customization in place, you can once again tap caps lock for escape and hold caps lock for control.

viddo commented 6 years ago

Yay, I had been thinking about looking into this too. 👍

I believe it's a bug on Karabiner-Elements, there are at least two long issues with reports:

jasonrudolph commented 6 years ago

@viddo: Thanks for sharing links to those issues. :bow:💟

jnunemaker commented 6 years ago

I think this is actually better for me as well. Currently I have a profile for my laptop keyboard and my external keyboard. Merging this means the global caps => control setting, which I use to use, but removes having multiple profiles and needing to swap them. The only thing I was worried about was tap control for escape but that works through hammerspoon so this seems good to me. 👍