kit icon indicating copy to clipboard operation
kit copied to clipboard

Snippets doesn't work on my mac os Ventura 13.1 (M1 Pro)

Open abdurahmanus opened this issue 2 years ago • 18 comments

Apple M1 Pro Ventura 13.1 Kit Version 1.40.62 (1.40.62)

I switched on the toggle in Privacy and Security/Accessibility and Privacy and Security/Input Monitoring for Kit app. Then I type snippet text, for example "kit,," from Sample Snippet example in a text editor (vs code) or anywhere else, nothing happens.

abdurahmanus avatar Jan 19 '23 21:01 abdurahmanus

You'll also need to manually start the keyboard watcher to snippets to run:

CleanShot 2023-01-19 at 14 59 59

johnlindquist avatar Jan 19 '23 22:01 johnlindquist

Thank you @johnlindquist, that really helped me! Although it doesn't work in some cases, but I'll play around with it 😀

abdurahmanus avatar Jan 19 '23 22:01 abdurahmanus

and by the way could you explain why keyboard.type from the example does not work, but setSelectedText does?

abdurahmanus avatar Jan 19 '23 22:01 abdurahmanus

You may need to hide the prompt first:

// Name: Testing Keyboard Type

import "@johnlindquist/kit"

await hide()
await keyboard.type(`Hello world!`)

Open testing-keyboard-type in Script Kit

Also, some apps like Google Docs, interfere with typing by trying to automatically correct text, etc. So results may be inconsistent in "smart" editors fighting over keyboard control

johnlindquist avatar Jan 19 '23 22:01 johnlindquist

thanks again @johnlindquist, impressive work

abdurahmanus avatar Jan 19 '23 22:01 abdurahmanus

I swear they were working before. Is there anything interfering that can chagne this?

danielo515 avatar Feb 02 '23 16:02 danielo515

@danielo515 If you adjust your log level to "silly", do you see it tracking your keystrokes in ~/.kit/logs/kit.log?

CleanShot 2023-02-02 at 09 20 39

johnlindquist avatar Feb 02 '23 16:02 johnlindquist

Adjusted, opened the log and nope, there is no log about keystrokes. I have raycast running, which also triggers snippets and it works. May it be interfering?

danielo515 avatar Feb 02 '23 17:02 danielo515

Yeah, it's definitely possible. Does this fix it?

CleanShot 2023-02-02 at 10 21 33

I can try and add some logic of something like:

"if hasn't detected a keystroke in 1 minute, restart watcher"

There's no way to detect if it's "on" otherwise (that I'm aware of)

johnlindquist avatar Feb 02 '23 17:02 johnlindquist

That sounds reasonable to me. However, I tried manually restarting it and it doesn't make a difference either. It is weird because it worked before.

On Thu, Feb 2, 2023 at 6:24 PM John Lindquist @.***> wrote:

Yeah, it's definitely possible. Does this fix it?

[image: CleanShot 2023-02-02 at 10 21 33] https://user-images.githubusercontent.com/36073/216396629-3fff5ba1-0862-4a26-a688-04fabc498573.png

I can try and add some logic of something like:

"if hasn't detected a keystroke in 1 minute, restart watcher"

There's no way to detect if it's "on" otherwise (that I'm aware of)

— Reply to this email directly, view it on GitHub https://github.com/johnlindquist/kit/issues/1013#issuecomment-1414103543, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKJWIFI4B7V4UMEWPZQQ3WVPUTDANCNFSM6AAAAAAUA3B45I . You are receiving this because you were mentioned.Message ID: @.***>

--

https://danielorodriguez.com

danielo515 avatar Feb 03 '23 07:02 danielo515

I would trying quitting Kit.app then disabling/re-enabling permissions, then re-opening Kit.app.

OSX permissions can be finicky

johnlindquist avatar Feb 03 '23 18:02 johnlindquist

I had similar issues... adding await hide() before the type command helped.

achtan avatar May 03 '23 12:05 achtan

I have same issue for weeks now. I'm currently on MacOS Ventura 13.4.1. I've tried re-enabling permisions, wake watchers, etc. I even tried to do clean reinstall of ScriptKit. No luck.

Snippets and Shortcuts do not work for me :(

Logger don't show any error, i tried with simple snippet example

[silly] kitState.snippet =  kit,,

But nothing happened.

wysher avatar Jun 30 '23 13:06 wysher

Ok, I found solution for my issue:

  1. I needed to disable and re-enable permisions for few settings. And most important was Privacy & Security/Input Monitoring. Probably docs needs update to cover Mac OS Ventura changes in settings structure.
  2. For my custom kenv directory I needed to "trust" kenv, by selecting kit (tab)/manage kenv/Trust kenv and follow "danger zone" instruction.

Now all my snippets and shortcuts are working again.

wysher avatar Jul 03 '23 10:07 wysher

After last changes with trust, solution described above doesn't work anymore.

Only way I found is to move all my scripts to "main" kenv.

wysher avatar Jul 07 '23 10:07 wysher

@wysher by "latest changes", do you mean you're on the latest build and it stopped working?

There haven't been any changes to the "trust" system... But I did update the key watching library to the latest version.

What does it say in your "~/.kit/logs/kit.log" when you add a snippet script to a kenv?

johnlindquist avatar Jul 07 '23 11:07 johnlindquist

@johnlindquist I referred to last trust changes here https://github.com/johnlindquist/kit/releases/tag/2023-07-01-02-47-34 When I wrote about my findings few days ago I had previous version. The one, which doesn't show prompt after trusting kenv with "Scripts located in the following directory are now trusted to run automatically" and "How to Distrust"

Logs after trusting kenv now:

[2023-07-07 12:43:20.970] [info]  👩‍⚖️ Trusted Kenvs [ 'shared-kenv' ]
[2023-07-07 12:43:20.970] [info]  🌈 Refreshing Scripts...
[2023-07-07 12:43:20.970] [info]  Reset all idle processes
[2023-07-07 12:43:20.971] [info]  66828: 🛑 removed
[2023-07-07 12:43:20.971] [info]  Ensure idle process
[2023-07-07 12:43:20.983] [info]  Ignoring /Users/work/.kenv/kenvs/shared-kenv/scripts/snip-email.js // Snippet metadata because it's not trusted in a trusted kenv.
[2023-07-07 12:43:20.983] [info]  Add "KIT_WORK_DANGEROUSLY_TRUST_KENVS=shared-kenv" to your .env file to trust it.
[2023-07-07 12:43:20.983] [info]  Ignoring /Users/work/.kenv/kenvs/shared-kenv/scripts/todoist.ts // Shortcut metadata because it's not trusted.

[...]

[2023-07-07 12:43:21.071] [info]  Add one idle process
[2023-07-07 12:43:21.073] [info]  👶 Create child Prompt process: 68640  []
[2023-07-07 12:43:21.074] [info]  68640: 🟢 start idle Prompt
[2023-07-07 12:43:21.826] [info]  Attempt Hide: Blur
[2023-07-07 12:43:21.833] [info]  65940: Blur caused exit. Provide a "onBlur" handler to override.
[2023-07-07 12:43:21.845] [info]  DISCONNECT
[2023-07-07 12:43:21.846] [info]  EXIT { pid: 65940, code: 0 }
[2023-07-07 12:43:21.846] [info]  65940: 🟡 exit 0. Prompt process: /Users/work/.kit/cli/kenv-trust.js
[2023-07-07 12:43:21.846] [info]  65940: 🛑 removed
[2023-07-07 12:43:21.846] [info]  Attempt Hide: remove 
[2023-07-07 12:43:21.879] [info]  Prompt window in bounds.
[2023-07-07 12:43:21.984] [info]  changes [
  '/Users/work/.kenv/kenvs/shared-kenv/scripts/snip-email.js',
  '/Users/work/.kenv/kenvs/shared-kenv/scripts/todoist.ts',
]

wysher avatar Jul 07 '23 11:07 wysher

@wysher Ok, thanks, I'm digging into it. I'll try to get back to you today

johnlindquist avatar Jul 07 '23 15:07 johnlindquist