kit icon indicating copy to clipboard operation
kit copied to clipboard

Blur caused exit. How to keep the window open?

Open uniphonic opened this issue 1 year ago • 10 comments

I'm trying to keep a script running while I do something in another window but it keeps closing whenever the ScriptKit window loses focus. The log shows:

[2023-03-18 21:49:37.393] [info] 87957: Blur caused exit. Provide a "onBlur" handler to override.

I've tried a few different types of onBlur handlers, but none has worked, and I can't find any reference to this in the documentation. How do I keep the window open while it's not in focus?

Thanks!

uniphonic avatar Mar 19 '23 02:03 uniphonic

@uniphonic On my phone, so quick answer:

Try:

await arg({ ignoreBlur: true })

ignoreBlur should work on all prompt types

johnlindquist avatar Mar 19 '23 02:03 johnlindquist

Does this also work on await drop()? @johnlindquist

kostasx avatar Apr 25 '23 10:04 kostasx

@kostasx ignoreBlur should be on by default when using drop. Is that not the behavior you're seeing?

johnlindquist avatar Apr 25 '23 14:04 johnlindquist

@johnlindquist Not really. The ScriptKit window goes away once I focus elsewhere. (running on Mac M1 Monterey)

kostasx avatar Apr 25 '23 15:04 kostasx

Same here

mizagog avatar Jul 10 '23 05:07 mizagog

@mizagog @kostasx Which version of Script Kit are you on?

This should keep the window from hiding behind other apps when losing focus:

await drop({
  placeholder: "Drop a file",
  alwaysOnTop: true,
})

Please show me your script if that's not what you're experiencing.

johnlindquist avatar Jul 11 '23 14:07 johnlindquist

using both works for me!

    alwaysOnTop: true,
    ignoreBlur: true

mizagog avatar Jul 12 '23 08:07 mizagog

@johnlindquist , is there a way to keep multiple ScriptKit windows open simultaneously? For instance, if I want to have multiple "chat" windows going on simultaneously?

When I use let chatWindow = chat({ ignoreBlur: true, alwaysOnTop: true, onSubmit: async input => { console.log("input",You said, "${input}"); }, }); This closes any time I try to run different ScriptKit script. Any way to keep multiple of them open, like a typical app would? Thanks!

uniphonic avatar Dec 03 '23 19:12 uniphonic

@uniphonic no, it's not possible. All the app state is bound to a single window.

Multiple windows will be the major focus of v3 though. (v2 is "done", just doing some housekeeping and releasing soon). Sometime next year is the best I can give you on a timeline.

johnlindquist avatar Dec 03 '23 20:12 johnlindquist

Multiple windows are arriving as we speak

JosXa avatar May 02 '24 00:05 JosXa