johnlindquist / kit

Script Kit. Automate Anything.
https://scriptkit.com
MIT License
3.91k stars 138 forks source link

Hotkey causes all shortcuts to fail #1491

Open probablycorey opened 5 months ago

probablycorey commented 5 months ago

If I run this simple script, it will work the first time by saying "hello". But then it doesn't work anymore. It also causes all my other kit shortcuts to fail.

// Shortcut:  option  h

const keyInfo = await hotkey()
if (keyInfo.hey == 'x') await say("hello")
johnlindquist commented 5 months ago

Thanks for reporting this. A workaround for now:

const keyInfo = await hotkey()
if (keyInfo.hey == "x") await say("hello")

await arg({
  onInit: async () => {
    exit()
  },
})

All Kit's shortcuts pause when they detect a "hotkey" prompt type, then resume on any other prompt type. So adding an arg that immediately exits will force all the shortcuts back on.

I missed this because all of my use cases follow-up on hotkey with another prompt. I'll get it fixed for v3 where the shortcuts resume on submit/exit instead.