geekhack

geekhack Community => Ergonomics => Topic started by: pyro on Tue, 16 March 2021, 16:09:12

Title: Spaceshift on Mac?
Post by: pyro on Tue, 16 March 2021, 16:09:12
Is it possible to achieve Spaceshift on a Mac? On Windows I use remapkey.exe (from Windows Resource Kit Tools) and Autohotkey (AHK), on Linux xkb/xmodmap, xcape, xbindkeys get you there, but what about Mac? Anybody done this before?

For clarification, by Spaceshift I mean that the spacebar behaves like Shift when pressed and held, but produces a Space character on release if no other button was pressed in between press and release.
Title: Re: Spaceshift on Mac?
Post by: nevin on Tue, 16 March 2021, 16:42:44
some mac remapping apps:
- KeyRemap4MacBook
- Karabiner
- ControllerMate

whether they do that specific action... i don't know for sure, never looked into that particular action.
Title: Re: Spaceshift on Mac?
Post by: Gorbon on Tue, 16 March 2021, 17:53:04
Karabiner-Elements (https://karabiner-elements.pqrs.org/) can easily do this and much much more. I've been using it extensively for quite some time now.

I wrote you a small config for that. Put it in a .json file under "~/.config/karabiner/assets/complex_modifications/" and then you can enable it in "preferences > complex modifications".

You can adjust the timing parameters to your preferences.

Code: [Select]
{
  "description": "Spaceshift",
  "manipulators": [
    {
      "type": "basic",
      "from": {
        "key_code": "spacebar",
        "modifiers": {
          "optional": [
            "any"
          ]
        }
      },
      "to_if_alone": [
        {
          "key_code": "spacebar"
        }
      ],
      "to_if_held_down": [
        {
          "key_code": "left_shift"
        }
      ],
      "parameters": {
        "basic.to_if_alone_timeout_milliseconds": 200,
        "basic.to_if_held_down_threshold_milliseconds": 200
      }
    }
  ]
}

If you're interested, you'll find lots more in karabiner's documentation (https://karabiner-elements.pqrs.org/docs/).
Title: Re: Spaceshift on Mac?
Post by: pyro on Tue, 16 March 2021, 19:03:23
That's great, thank you!