Did Lock/Unlock Screen don't remap keys (low level)

I'm trying to remap the same key to two different keys depending on the triggers "Did Lock Screen" and "Did Unlock Screen".

I have tried different "from keys" and different "to keys" but any key is never remapped correctly. .

It would be possible to remap keys before and after locking the screen?

*BTT 4,988 & Sonoma 14,7,2

I’ll have a look! Does the remapping action in general work for you? (you can test it with some other trigger to make sure it’s not a problem with the action)

Please find the attached preset to reproduce these steps:

  1. Assign any shortcut as a trigger (Shift+Esc in the attached preset)

  2. Set its action to "Cycle through multiple actions"

  3. Set action 1 to remap the caps lock to 1 and a hud overlay showing CAPS=1

  4. Set action 2 to remap the caps lock to 2 and a hud overlay showing CAPS=2

  5. Press the shortcut

  6. The hud overlay shows 1 and caps lock types 1

  7. Press the shortcut

  8. The hud overlay shows 2 and caps lock types 1

It seems that the problem is that the first value that a remapped key takes can’t be changed via actions anymore.

If you restart BTT, the issue is not fixed.

If you restart the computer, the caps lock will work as caps lock. If you press the shortcut in this scenario, the caps lock will take the value of 1 or 2. Once the value is assigned, it can’t be changed using the action of the shortcut, as described previously.

In the other hand, I can change the remapping key of the same key at anytime using the ”remap key” trigger in the automations section.

So the trigger can remap multiple times the same key, but the action can only remap a key for the first time.


Another issue I see for remapped keys:

  1. remap key ”F1” to key ”a” in automations section

  2. quit BTT or disable BTT

  3. press F1 and ”b” will still be typed

So the remapping is not removed when BTT is quitted or disabled. If this behaviour is intended, it could be documented in the configuration sidebar to avoid potential problems to users.


If I try to remap keys a to z and 0 to 9 (not keypad numbers) to any other key in the automations section, this remapping is not working. Same for volume_up, volume_down, brightness_up, brightness_down. These keys are working fine in the "To Key: " configuration, but not in the "From Key: ".

REMAP KEY ACTION.bttpreset (9.4 KB)

More info:

  1. remap the caps lock using the action with the previous uploaded preset
  2. once the caps lock types 1 or 2, remove the preset
  3. remap the caps lock to 3 in automations section
  4. press the caps lock and it will never type 3, even you restart BTT
  5. restart the computer and caps lock will type 3

So the summary of the current behaviour is:

  1. the trigger can remap multiple times the same key, except if an action has remapped previously that key (in this case the trigger will not work)
  2. the action can remap a key, but only for the first time. Second, third, and successive attempts will not work.

Could you check whether it behaves as expected on 4.991 ? (uploading now)

Btw. if necessary you can reset all remappings here:

1 Like

Version 4,991 works fine, but there is one unexpected behaviour.

Using the previous preset, try the following:

  1. Remap Caps Lock to key "3" in Automations
  2. Open a new doc in TextEdit
  3. Press the shortcut to toggle between Caps=1 and Caps=2 and press the Caps key to type 1's and 2's in the TextEdit document. This works as expected.
  4. Switch to Finder
  5. Switch to TextEdit again
  6. Press the Caps Lock key and you will type 3 instead of 1 or 2

So it seems that there is a conflict when triggers and actions are remapping the same key if the frontmost app changes.

I understand that the correct behaviour would be that Caps is remapped to Caps=3 when starting BTT due the trigger, and if the shortcut is pressed then Caps would be remapped to Caps=1 or Caps=2 without loosing this last remapping after switching apps.

That's true, always the "last executed" will win. As the ones defined in automations will reload when the app changes, these would override any previously set.

I think it makes sense to give the predefined actions priority, I'll have a look.

1 Like

Try this also:

  1. Remove any remapping trigger of Caps Lock in Automations
  2. Open a new doc in TextEdit
  3. Press the shortcut to toggle between Caps=1 and Caps=2 and press the Caps key to type 1's and 2's in the TextEdit document. This works as expected.
  4. Switch to Finder
  5. Switch to TextEdit again
  6. Press the Caps Lock key and you will toggle Caps instead of typing 1 or 2

The remapping actions are removed after switching apps even when there are no remapping triggers in automations.

1 Like

4.992 should now always give priority to remappings done via action. However they will not persist BTT restarts - only the ones configured in automations will persist.

Installed 4,993, and key remapping works like a charm! :grinning:

I can now remap keys when screen is locked and unlocked perfectly.

I only detect one issue with the "Reload Remappings Now" button:

  1. Remap Caps Lock to key "3" in Automations
  2. Press the shortcut to toggle between Caps=1 and Caps=2 (Actions)
  3. Go to the trigger in BTT/Automations that is remapping Caps=3
  4. Click "Remove All Remappings". It works, pressing Caps Lock now toggles the Caps Lock function
  5. Click "Reload Remappings Now"
  6. Instead of typing 3, pressing the Caps Lock will type 1 or 2
  7. Even if you remove the shortcut trigger that toggles between Caps=1 and Caps=2, Caps will never change to 3 when clicking "Reload Remappings Now"

Other remarks:

  • remapped keys persist when BTT is disabled
  • a to z and 0 to 9 can't be remapped (I can't test keypad keys as I only have small apple keyboards)
  • it would be useful to have actions for "remove all remappings" and "load all remappings"

yep, this is because it is using a system level function at a lower level than BTT. I'll make this more clear

//edit: ah well, maybe I'll just call reset whenever BTT quits.

  • a to z and 0 to 9 can't be remapped (I can't test keypad keys as I only have small apple keyboards)

that is weird, I have remapped multiple of these but I'm on macOS 15, maybe there is a difference.

Running BTT v4,9551 and Sonoma 14,7,2

Let's say Caps Lock is remapped to 1.

If I quit BTT, Caps Lock toggles Caps Lock. That's correct.

But if I disable BTT, Caps Lock doesn't type 1 and doesn't toggle Caps Lock.

I think some users would prefer that the remapping keys persist when BTT quits or disables.

What do you think of adding two checkboxes in the remapping action side-bar:

  • this remapping persist when BTT quits
  • this remapping persist when BTT is disabled

If it's not possible a per-key-remapping config, it could be in global preferences.

I think most should be fine without that option, as BTT in general needs to stay running for its functionality I think it's good to disable the remappings as well when quitting BTT.
It adds quite a bit of complexity to have both options.

1 Like

Yes, I agree, it makes sense.

So the only pending issue to fix is when disabling BTT: the remapped keys are removed, but they don't recover the original function, they are "frozen".

I have also tried the 3 buttons in the trigger sidebar and none of them are working as expected:

  • Activate Remapping Now (working well in previous versions)
  • Reload Remapping Now
  • Remove All Remapping (working well in previous versions)

Example for Remove All Remapping button:

  1. Remap Caps Lock to "3" in Automations (trigger)
  2. Press the shortcut to remap Caps to "1" (action)
  3. Go to the trigger in BTT/Automations that is remapping Caps=3
  4. Click "Remove All Remappings". Pressing Caps Locks is still typing 1 instead of toggle Caps.

Example for Activate Remapping Now button:

  1. Remap Caps Lock to "3" in Automations (trigger)
  2. Press the shortcut to remap Caps to "1" (action)
  3. Go to the trigger in BTT/Automations that is remapping Caps=3
  4. Optional step: Click "Remove All Remappings"
  5. Click "Activate Remapping Now". Pressing Caps Locks is still typing 1 instead of typing 3.

Example for Reload Remappings Now button:

  1. Remap Caps Lock to "3" in Automations (trigger)
  2. Press the shortcut to remap Caps to "1" (action)
  3. Go to the trigger in BTT/Automations that is remapping Caps=3
  4. Click "Remove All Remappings"
  5. Click "Reload Remappings Now". Pressing Caps Locks is still typing 1 instead of typing 3.

I have tried also (for the first time) the button "Reset All Low Level Key Remappings" in Prefs/Keyboard. It's also not working as expected:

  1. Remap Caps Lock to "3" in Automations (trigger)
  2. Press the shortcut to remap Caps to "1" (action)
  3. Go to Prefs/Keyboard and click "Reset All Low Level Key Remappings"
  4. Pressing Caps Locks is still typing 1 instead of toggle Caps.

The disabling will be supported with the next alpha! I think the buttons are not needed anymore as they would immediately be overridden again by the other logic. I'll remove them :slight_smile: (but keep the reset all in the settings)

It would make sense to add an option for remapping to the default value?

In other words: is it ok to remap "caps lock" to "caps lock", or it would be better for BTT to remap "caps lock" to "default value"?

BTT recognizes key to same key remappings and automatically deletes them in this case. So this is fine!

1 Like

Running version 4.998 and sonoma 14.7.2

FYI, disabling BTT is not disabling the remapped keys. The rest of things are working as expected.