How to use a similar function to ifShift when it comes from a macro

Hi guys, I have a problem with a macro. I want to invert the key slashAndQuestionMark, in order to get that, I tried to put the next code in a macro:

ifNotShift suppressMods tapKey LS-slashAndQuestionMark 
ifShift suppressMods tapKey slashAndQuestionMark

But I have another macro named Caps on doubletap assigned to my regular Shift key, this macro do the next:

holdKey leftShift
ifDoubletap tapKey capsLock

I realized that my first macro works only when I use a regular Shift, no a macro, and I found this in the documentation,

  • ifShift/ifAlt/ifCtrl/ifGui/ifAnyMod/ifNotShift/ifNotAlt/ifNotCtrl/ifNotGui/ifNotAnyMod is true if either right or left modifier was held in the previous update cycle. This does not indicate modifiers which were triggered from macroes.

And I was wondering how to work it out this, so I tried to use ifKeyActive and ifNotKeyActive, without success. Could you guys give a hand with this? Thanks in advanced.

Change your shift macro to:

holdKey iLS
ifDoubletap tapKey capsLock

For explanation, search https://github.com/UltimateHackingKeyboard/firmware/blob/master/doc-dev/reference-manual.md for “composition modes”.

2 Likes

Thanks so much Karel, you’re the best, it works like a charm. I’m going to dive in the documentation to learn more.

1 Like

I know you have a solution already, but to just switch the shifted and unshifted function of a key you can also introduce a Shift layer. There you assign the (in that case) unshifted key and on the base layer you assign the shifted version. I use this with success to change a US international layout in the operating system to my custom layout, where some keys need to swap shifted function as well.

2 Likes

That’s interesting. Let me try it, I’d like to apply this functionality on more keys, and I think that I should do less work with this approach. Thanks for sharing @rpnfan. Greetings.

When this macro is assigned to right shift, should we replace iLS with iRS?

Depends whether you want right shift (physical key) to send the left shift (modifier) or the right shift (modifier). :person_shrugging:

1 Like