jtroo / kanata

Improve keyboard comfort and usability with advanced customization
GNU Lesser General Public License v3.0
3.21k stars 131 forks source link

Feature request: Auto Mouse Keys layer #1081

Open wolfwood opened 6 months ago

wolfwood commented 6 months ago

Is your feature request related to a problem? Please describe.

when I move the mouse cursor using my left hand on the trackpoint, I would like mouse buttons to appear under my right hand fingers on my laptop keyboard. after a timeout, I would like the keys to revert. the generalization of this is automousekeys layer switching.

previously, I've been using mannaharbour's automousekeys implementation with QMK-powered external keyboards.

Describe the solution you'd like.

My initial thought for an implementation was a defcfg feature flag that takes a layer name and a timeout. a very nice-to-have would be to also accept a list of layers upon which the automousekeys switching can activate. I might like to only have it on my base layer, but not on my navigation layer, for example.

however, I wasn't sure how to force layer switches, and especially how to return from one, with keyberon.

Describe alternatives you've considered.

I implemented a Proof of Concept in #1080. This takes an easier approach of injecting key press and release events for an unused key which the user is expected to map to a layer hold. For example:

(defsrc
  k l ;
  F24
)

(deflayer qwerty
  k l ;
  layer-while-held mouse
)

(deflayer mouse
  mlft mmid mrgt
  XX
)

The addition of a key that doesn't exist on the keyboard seems clunky, but it does provide a nice way to manage the per-layer configuration of the feature. I'm half convinced this is an OK way to handle it, but I think the initial solution is cleaner overall.

Additional context

I feel the layer switching needs to be a bit smarter to be fully useful.

In the QMK version I update the timestamp when mouse key events occur, as well. for this version I might like to ignore real mouse keys (if I'm using the physical buttons I don't need the layer switch) but update the timestamp when non-transparent key events occur on the mouse layer. not sure how to get that info.

For switching the mouse layer off, I would really like this to occur any time I press a transparent key on the layer, and I want to trigger the underlying key mapping as well. I think any press of an unmapped key would also ideally switch the mouse layer off as this is also a sign the user has resumed typing.

finally, since I also use homerow mods, I would like to try having hold behaviors on the mouse layer trigger a layer release as well.

jtroo commented 6 months ago

Sounds like you might be able to achieve this today with some combination of:

oblitzitate commented 6 months ago

Is there a way to detect if a finger or fingers are on the touchpad (even when not moving)? If so, that would be great in addition to this functionality.