Escape on caps lock with secondary role mouse prevents functional backlighting (UHK60v2)

Hi,

one of the more recent updates has added the option of setting a secondary role for a key.
Following the recommendation of the hints in agent I have set the scan code for the caps lock key to “Escape” and the secondary role to “Mouse”.
It works like expected. I can send escape by tapping caps lock and if I hold it down and e.g. press one of the arrow keys the pointer is moving.
What also works as expected, is the secondary role being triggered, as described in the hint, when caps lock is held down and another key is pressed.
Before a second key is pressed the keyboard doesn’t go into its secondary role mode and thus the functional backlighting is not activated.
The keyboard stays lit completely, unlike when I hold down Fn or Mod.
Before using caps lock with the secondary role it would enable the functional backlighting for the mouse layer on hold too, but I really miss escape on caps lock, so I’d rather guess keys when it is dark :smiley:

Is there a way to make it light up the mouse layer keys when the caps lock key is held down, even before I press another key?
Be it by enabling the secondary role mode on caps lock down or with some sort of workaround that triggers the functional backlight for this layer.

Thank you

1 Like

This macro should do the trick:

holdLayer mouse
ifNotInterrupted tapKey escape

:slight_smile:

4 Likes

ohhhhhh. i’ve had this setup for years and just thought there was nothing i could do about the mouse layer needing secondary click. thanks

1 Like

yep this works amazingly. I need to play around with my keyboard more :sweat_smile:

1 Like

Thank you @kareltucek, this works like a charm! Amazing work on the whole macro system!

Since I failed to properly configure the macro at first:

  1. Left hand navigation “Macros”: click on the plus button to create a new macro and name it whatever you want
  2. In the macro view click on “Add macro action”
  3. Select the “Command” tab/section
  4. Paste the macro from above into the text field and click “Save”
  5. Go to your keymap (left hand navigation)
  6. Click on the caps key (or any other of your liking)
  7. Select the “Macro” tab
  8. Select your macro from the “Play macro” dropdown and click “Remap key”
  9. Save to keyboard

Maybe Karel’s solution could be added to the knowledge base or some sort of sticky/FAQ thread. I found a couple of threads in the search here, but this solution seems to best and cleanest for this popular issue, @Laszlo_Monda

1 Like

I don’t think it is worth it.

It is actually included as one of the basic examples in the introductory text at firmware/doc-dev/user-guide.md at master · UltimateHackingKeyboard/firmware · GitHub

I tried this! I have a NumPad as a secondary action under my Tab key. It also only lit the custom colors after I hit a key and I had the same question. So, thanks for sharing!

However, with the macro, now my entire keyboard flashes every time I hit the Tab key shortly, which is also not what I wanted :sweat_smile: Don’t know if it’s possible to add a timeout of some sorts? Just curious, but really not important, haha! :smiley:

1 Like

You might not need the macro.

With the advancedStrategy for secondary roles you can define a timeout. It will then only switch the the secondary role if you either press a second key while the dual-role key is held down, or the timeout expires. I use this for my maxtend and numtab keys, so they don’t switch layer when I only briefly tap them.

These are the settings I use for Typing behaviour:

In macros, I differentiate primary/secondary roles with ifSecondary advancedStrategy, but it’s probably sufficent to just configure the secondary layer switch directly in Agent:

image

4 Likes

Awesome! Thank you for sharing your config. I will try that!

Edit: worked like a charm! Thanks!

2 Likes