kasper / phoenix

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

Keybindings are suddently lost #220

Closed andyHa closed 6 years ago

andyHa commented 6 years ago

With my current configuration (https://gist.github.com/andyHa/0f7e3ebab503acd70b4fb16e9496ad61)

Everything works a charm (I can move windows across screens and maximize them) and suddently without any log / error / warning - the keybindings stop working (approx 10-20 seconds after loading the config).

I placed logs inside the functions to ensure that there isn't a bug - they arn't called at all. However, I used a timer (1 second interval) which printed a "Hello" - which was still going.

Any hint / reason / workaround, why the keybindings are suddently lost? (BTW - reloading the config "fixes" the problems and the bindings are available for another 20 seconds)...

mafredri commented 6 years ago

This easily trips you up the first time you're using Phoenix, but you're required to save your handlers in a (global) variable, otherwise they will be garbage collected and stop working. If you don't wish to do that, you can use the Key.on method instead of new Key.

andyHa commented 6 years ago

Awesome - switched to Key.on, works like a charm!