Handy icon indicating copy to clipboard operation
Handy copied to clipboard

Support mac Fn shortcut handling

Open tekacs opened this issue 3 months ago • 11 comments

  • special-case "fn" bindings via rdev listener so mac users can use Fn
  • reuse shortcut dispatcher to drive existing push-to-talk/toggle flow
  • expose Use Fn button on mac settings and keep Cmd glyph formatting

tekacs avatar Sep 28 '25 03:09 tekacs

🙏🏻

akshar-dave avatar Sep 28 '25 06:09 akshar-dave

Thanks for this I'll give it a look and test. Do you know if you tauri build the release does it require extra permissions for rdev on MacOS? The initial versions of Handy used rdev and a custom global keyboard shortcut library, but required extra permissions

cjpais avatar Sep 28 '25 14:09 cjpais

Hmmmm. I have it using input monitoring – is that something that you have in your main branch(es) as well?

tekacs avatar Sep 28 '25 15:09 tekacs

Yeah that was actually the reason I moved away from it. I felt like it might feel too much like a key-logger or something which I was hesitant to add the permission for

cjpais avatar Sep 28 '25 16:09 cjpais

I hear that – the thing is that I think it's... almost necessary? For push-to-talk, holding two keys is distinctly less than ideal.

Interestingly, both Wispr Flow and VoiceInk don't use that permission, so it's likely spurious? If I get a chance I'll investigate why.

tekacs avatar Sep 28 '25 16:09 tekacs

Right, I've been trying to figure that out as well. I used MacWhisper for a while and don't recall the permission either. There must be some system native way of doing this

cjpais avatar Sep 28 '25 16:09 cjpais

@cjpais this now works using only Accessibility permissions – tested by removing the Input Monitoring permission and using fn successfully. Should supersede #163 too.

tekacs avatar Oct 03 '25 22:10 tekacs

Let's go, thank you! I cannot wait to test it. Hopefully I'll be able to on Tuesday and pull it in. Thanks

cjpais avatar Oct 04 '25 03:10 cjpais

I tested this, however, I haven't looked at the code thoroughly yet. I do see that this only supports the function key. It would be really cool to move the entire code to use this general method of input detection on Mac OS, and move away from using the Tauri Global shortcut. This is so we have consistent behavior on Mac OS

Ideally can also detect fn in the frontend instead of adding a UI button. I don't really want that UI button to exist, the user should just be able to click the keyboard ideally. I would think javascript can get the keycode and we might just need to map it. I believe the other PR supports that however I have not tested it

cjpais avatar Oct 07 '25 19:10 cjpais

@cjpais Where's the best place to discuss this at the mo? Feels like there are a bunch of issues/PRs/discussions about handling keyboard shortcuts.

My tuppence...

  • I'd very much like to use fn as my PTT trigger on macOS.
  • Other people seem very keen on all sorts of other key mappings for PTT/persistent or plain/translated/LLM-enriched etc etc etc.
  • Supporting complex keymappings via a not-horrible UI is likely to take a little thought. I wonder if it'd make more sense to support more complex keymappings via user editing of settings_store.json or some other config file?

Related...

I'd also like the ability to disable Handy's shortcuts when certain apps are focussed (ie those with conflicting app-local keybinds)

dannysmith avatar Nov 19 '25 23:11 dannysmith

I'm very happy to support mappings through json right now and I think that's a good tradeoff before UI comes in.

In regards to handling more keybinding generally I think we can do it here or in an issue if there is one. I really want this one to come in as well it just needs testing and validation that it won't require special perms on macOS, and it should be generalized beyond the fn or globe key I think to support any binding within reason

cjpais avatar Nov 20 '25 06:11 cjpais