only using a single modifier key as a trigger?

Is there a way to use a modifier key (ctrl for example) as a shortcut trigger, with no additional buttons pressed? Anything i try in the BTT settings, it doesnt let me do this...

Use the section "key sequences"

1 Like

But what, if i want to execute a "execute shortcut as long as key is pressed down" command?

What do you want to do exactly?

More details you give, more easy to get help or ideas...

1 Like

@pep is right. Use a key sequence.

As far as I know this is not possible with key sequences because there is no key repetition. This is only possible in the "shortcut" section. But there you can't use single modifiers as triggers.

1 Like

correct - not possible right now. Although maybe it is, I think the only part preventing this from working with normal shortcuts is the shortcut recorder not allowing it. Maybe It can work by editing the json directly - I'll have a look later today

1 Like

This could certainly be a useful feature. :slightly_smiling_face:

But wouldn't that interfere with the normal shortcuts? If command down and held triggers something, how should you be able to use command + letter?

That seems to me the reason why with a key sequence the single modifier trigger has to be "on key up". If there is a letter in between, the sequence is interrupted.

And that is maybe the reason why a kind of "time trigger" would make sense. Hold command down for 1s, if no further key follows, then trigger something.

You once had this thought for the key Sequence

"I think the key sequences feature would would need (in addition to the "max pause between key presses") a "minimum pause between key preses" and additionaly a way to to match a range (or all) keys. Both could be nice additions in general, I'll check whether I can add this."

1 Like

Right, so here is what i want to do:

I want to assign a "left-click-hold-down" action to the ctrl-key (while pressed down) and a release action, when i finally release the ctrl-key.

And i would like to assign a simple right click action to the trigger "fn key + ctrl key".

This works absolutely flawlessy for the "<"-key and shift + "<"-key right now, but i would like to move these shortcuts one row down on the keyboard, but i cannot assign them in the shortcuts-section.

This should be possible. You need these two key sequences


custom left klick when down


custom left click when up

1 Like

Oh, very cool, thanks! Will have to try that out, for sure!

Maybe just as a follow up question, how would i go about changing the mapping of the respective keys on a system level? So that everytime i press the ctrl-key, Mac OS thinks, i am pressing the "<"-key?
I once heard that there a terminal commands for that.

Is this still a thing?

You want to press control and type this character "<"?

Action:

image

1 Like

Thanks, but actually i would like to "change" these two keys for the mac os system. So that the "<"-key acts as a fully functional ctrl-key and vice-versa. Is that possible?

Then you probably need Karabiner Elements.

1 Like

You can do it using the hidutil integrated in macOS.

If you want to do it persistently, the best way is hidutil key remapping generator (hidutil-generator.netlify.app)

If you don't mind running a terminal command everytime your mac restarts, you can use this (you can run this e.g. with the "After BetterTouchTool Did Start" automation:

The code for the <> key (only available on few international keyboards) is 0x700000035

/usr/bin/hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x7000000E4},
{"HIDKeyboardModifierMappingSrc":0x7000000E4,"HIDKeyboardModifierMappingDst":0x700000035}]}'

This command remaps that key to right-control (0x7000000E4) and vice versa

1 Like

Thats literally perfect! Exactly what i want, thanks!

Which Terminal-Action should i use in BTT, sync or async?

doesn't matter for this :wink:

1 Like

I am getting an error message in terminal, is it because of my german keyboard layout?
I want to swap "<" (over the left ctrl-key) with the left ctrl-key.
But maybe it is, because i replaced the E4 with E0

The error message:
% /usr/bin/hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x7000000E0},

{"HIDKeyboardModifierMappingSrc":0x7000000E0,“HIDKeyboardModifierMappingDst":0x700000035}]}'

2023-05-08 22:08:30.854 hidutil[761:9179] NSJSONSerialization Error Domain=NSCocoaErrorDomain Code=3840 "No string key for value in object around line 2, column 45." UserInfo={NSDebugDescription=No string key for value in object around line 2, column 45., NSJSONSerializationErrorIndex=155}

ERROR!!!! Unable to create property object for '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x7000000E0},

{"HIDKeyboardModifierMappingSrc":0x7000000E0,“HIDKeyboardModifierMappingDst":0x700000035}]}'

It looks like the wrong type of quote is used, it needs to be " not “ (but it's hard to tell whether this is the issue or a formatting issue here on the forum)

I tested the command with my german keyboard, so that shouldn't be an issue

/usr/bin/hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x7000000E0},
{"HIDKeyboardModifierMappingSrc":0x7000000E0,"HIDKeyboardModifierMappingDst":0x700000035}]}'
1 Like