evantravers / Hyper.spoon

20 stars 2 forks source link

Unexpected limitation with Karabiner #1

Closed codeanpeace closed 2 years ago

codeanpeace commented 2 years ago

So first off, I enjoyed your article and really like the idea of Hammerspoon as the translation/automation layer. That said, leveraging unused function keys seems to have a downside.

Context: I've long used my caps lock as escape if pressed alone and hyper or control as modifier otherwise via Karabiner. While Karabiner allows you to suppress sending the modifier with "lazy": true when key is pressed along, it doesn't work with non-modifiers like function keys. For example, hitting caps lock once for escape sends both escape and function key keycodes whereas with traditional hyper the modifiers are suppressed and only escape sent as discovered via Karabiner EventViewer.

This means that for those of us who use vim extensively, random characters get inserted that behave oddly. In my case, the f20 key press sent by Karabiner results in a ^P.

image

Open to suggestions for thoughts and workarounds!

ps feel free to close this as it seems more of a Karabiner limitation, but figured I'd share as it does affect the usability unexpectedly

evantravers commented 2 years ago

Hi! đź‘‹ Also a big vim guy.

Hmm… interesting. I've been 100% on non-standard keyboards for a while, and on my laptop keyboard I just have Caps -> Control with no magic.

Well… one nice thing about my Hyper implementation is that I think you can program in a different Hyper Key… it could be the traditional Hyper Chord, or another weird character if you wanted to:

Hyper:bindHotKeys({hyperKey = {{"cmd", "alt", "ctrl", "shift"}, ["§"}})

If you are on any external keyboard, I really recommend checking out programmable keyboards and handling that in the firmware using QMK or ZMK rather than using karabiner. I've also had a todo to check out kmonad to see if it has better tooling for this kind of thing than karabiner.

At this point… all I really use karabiner for is disabling the onboard keyboard when I plug in an external. :P

codeanpeace commented 2 years ago

Oh hey kindred spirit! đź‘‹

Hahah, don't remind me – I may have too many tabs open dedicated to ergo, ortholinear, staggered, tenting, DIY programmable keyboards at the moment. I switched from a mechanical das keyboard to a more ergonomic microsoft sculpt ages ago and was recently pleasantly surprised to discover that the ergonomic mechanical keyboard offerings have truly blossomed in the meantime.

Out of curiosity, does QMK or ZMK handle things like vim mode (s+hjkl) or mouse mode (d+hjkl moves cursor)? I've extended that functionality to move windows around (w+hjkl) among other things. I know it has layers, but haven't seen them used with character keys versus modifier keys. I make heavy use of send this key code if pressed alone otherwise do something else fun pretty heavily as you can probably tell. I've found that the caps lock to control when not pressed alone is super helpful for tmux especially and am thinking of putting the hyper key on tab instead.

Hyper:bindHotKeys({hyperKey = {{"cmd", "alt", "ctrl", "shift"}, ["§"}})

Nice, makes sense! Would no weird character be empty array then? e.g. {{"cmd", "alt", "ctrl", "shift"}, []}

At this point… all I really use karabiner for is disabling the onboard keyboard when I plug in an external. :P Hahah, how do you work on the go? Is the context/muscle memory switching difficult? That's my biggest concern to a radically different external ergo keyboard layout. The 40% like the Kyria, Corne, Dactyl-Manuform are ones I've been eying... 👀

evantravers commented 2 years ago

Oh yes. Typing on a 3x5_3 Corne-ish Zen at the moment: https://lowprokb.ca/

does QMK or ZMK handle things like…

Yes. You absolutely can implement arrows under hjkl… that's how my layout works right now. There is support for mouse keys in QMK, and coming soon to ZMK too.

be empty array then

Maaaaybe… except Lua doesn't have arrays, only tables. It's a weird language. table[key] is a syntax for accessing key in table.

how do you work on the go?

I carry keyboards with me. :P The muscle memory isn't bad. I don't have a problem with it. I've had the Kyria, Corne, not the Dactyl yet.

Feel free to email me if you have more keyboard questions! I may close this.