A parametrized gesture, and Cmd modifiers on macOS?

I’m trying to make a gesture that reads the following key and uses that when it sends the keys – I know this needs ifGesture and the time machine bit, but I’m not sure how to do it.

What I want: I type Fn-h <letter> and this sends `ctrl-alt-cmd-’.

The documentation isn’t clear to me how I tell my UHK to do all three modifiers at once, and how to read in that unknown next key and send it.

(I’m trying to use the macOS Hammerspoon tool, and want it to respond to keyboard shortcuts – and it’s hard to find something that nothing else will use, and that is also not hard to type. One suggestion from their documentation uses the above ctrl-alt-cmd – or, I guess, ctrl-option-cmd if we’re using macOS language – and I want to try that, but configure multiple shortcuts in Hammerspoon while using just one prefix/gesture in my UHK.)

Thanks!

Say, oneShot holdKey LALGLC mapped on the fn-h.

Then you tap fn-h, release them, tap a, which gives you control+alt+cmd+a.

Is that what you are after?

1 Like

Aha! Yes, that works for me. Thank you!

I didn’t know about oneShotand would have probably never found it in the documentation. I also couldn’t figure out the “G” – for “GUI”, the UHK’s agnostic term for command/super/windows, as the macOS/Linux/Windows folks would say…

2 Likes

I’ve been using the above macro, but it does not work consistently.

The real keybinding I’m trying to emulate here is ‘ctrl-alt-gui m’ (or…ctrl-option-command if we want macOS terms…). Whenever I do that, it works as expected.

But if I do the following, it sometimes works and sometimes doesn’t. The macro is bound to Fn-H; the exact sequence I do is:

hold down Fn; tap ‘h’; release both; tap m.

Weirdly, I’ve observed that the macro works more reliably after I do the manual version (ctrl-alt…) first. After doing that once, ‘Fn-h m’ seems better. But still not as reliable as I’d like.

Am I missing something about how oneShot or holdKey work?

Please, try to set keystroke delay on the Typing Behaviour tab to 10ms.

Thanks – that seems to be working better. I’ll see if it’s fixed the problem, or if I need a different delay.