zmk icon indicating copy to clipboard operation
zmk copied to clipboard

Abort behavior when switching to different Bluetooth profile

Open huber-th opened this issue 11 months ago • 0 comments

Summary

I noticed when switching BT profiles to a different device, that current behaviors in flight are not aborted/ended correctly. In particular I noticed this with my usage of the sticky key behavior.

I'm not familiar with ZMK code, but if possible I would suggest that timed behaviors (like sticky key etc.) which are in flight should ideally be cancelled on the active host, when a BT profile switch is initiated, before that switch is actually performed.

How to reproduce

I can't say for sure this isn't related to a very specific personal setup but wanted to report it in case this is a wider issue others might run into in the future.

My setup

I have 2 devices (both running latest macOS), one keyboard running ZMK, 2 mouses (mice?) and I am frequently switching the keyboard between the two devices. While the keyboard is actively connected to one device, I am still using the mouse of the other device. Mainly to navigate web pages.

Observation

Every once in a while I noticed that my mouse clicks on the device not holding the active keyboard connection would behave incorrectly. I realized today that it's behaving as if Shift + Click and finally made the connection to my sticky shift key mapping.

Turns out, if you trigger the sticky key behavior, then switch BT profiles before that sticky key behavior times out, it remains 'held' indefinitely on the device I just switched away from. Interestingly enough this seems to only relate to mouse clicks.

I can use other keyboards without problems. No all caps, I can use the shift key as expected on other keyboards. Yet, mouse clicks are performed as Shift + Click.

Turning the mouse (BT itself) off and on again has no impact. Clicks continue as Shift + Click. The only way to go back to the mouse behaving normal is to either switch the keyboard back to the affected device, or turn off the keyboard and wait until the device looses connectivity to the keyboard, at which point the mouse clicks behave as expected again.

huber-th avatar Mar 14 '24 19:03 huber-th