kasper / phoenix

A lightweight macOS window and app manager scriptable with JavaScript
https://kasper.github.io/phoenix/
Other
4.36k stars 129 forks source link

Ensuring cmd+space can be intercepted #327

Closed fabiospampinato closed 1 year ago

fabiospampinato commented 1 year ago

Cmd+space can't be intercepted apparently:

  Key.on ( 'space', ['cmd'], () => {
    // This is never called
  });
kasper commented 1 year ago

@fabiospampinato Hey! This is registered by macOS for Spotlight. You cannot register key combinations globally that are already registered by macOS or some other app.

fabiospampinato commented 1 year ago

I see 🤔 Is it not possible to do the same that Alfred is doing? Last time I tried it was able to intercept that shortcut, if I'm not misremembering.

kasper commented 1 year ago

Intercepting and keyboard shortcuts are different. Phoenix uses the official macOS API for registering keyboard shortcuts. You can also “tap” into global event streams (for providing accessibility features) and add/override behaviours for key events, this is what Alfred and Karabiner do to remap commands if I’m not mistaken. Tapping to key events is not supported in Phoenix at the moment and it would require a different API since the behaviour is different.