sballin / alfred-search-notes-app

Use Alfred to quickly open notes in iCloud/Apple Notes.
https://www.alfredforum.com/topic/11716-search-appleicloud-notes/
MIT License
502 stars 23 forks source link

Opening a note pauses for multiple seconds #81

Open Cykelero opened 2 months ago

Cykelero commented 2 months ago

On my Mac, when opening a note, Alfred usually freezes for 5-20 seconds after pressing enter; before it goes away and the Notes app is focused, selecting the note.

This isn't always the case: it seems that if the workflow was used very recently, the delay usually doesn't occur. (or, maybe, that's when the Notes app itself has been recently used, through the workflow or otherwise)

This happens regardless of whether Notes is hidden (⌘H) or not.

Keeping an eye on the Alfred workflow debugger, it seems that the “Show note/folder or create note” AppleScript action itself is stalling.

To Reproduce

Steps/context to reproduce the behavior:

  1. Search for a note using its title
  2. Press enter to reveal it in Notes
  3. Alfred sometimes freezes before the workflow continues

Debugger output

[...]
[15:29:16.634] Search Notes[Script Filter] Processing complete
[15:29:16.639] Search Notes[Script Filter] Passing output 'F1DF3F39-711D-4907-A605-446B5C4841F0,x-coredata://526BFCA4-DE6E-41D4-AF6A-C7587175957B/ICNote/p5290,null,x-coredata://526BFCA4-DE6E-41D4-AF6A-C7587175957B/ICFolder/p5312,yi' to Run NSAppleScript
[15:29:23.531] Search Notes[Run NSAppleScript] Processing complete
[15:29:23.546] Search Notes[Run NSAppleScript] Passing output '' to Run Script

Info

Fill out this information if it's not already included in the error text.

sballin commented 2 months ago

Does the problem persist if you change the showEnclosingFolder environment variable to 0?

You could also try unchecking "Cache compiled AppleScript" for the “Show note/folder or create note” script.

Cykelero commented 2 months ago

Thanks for the suggestions! I tried both changes, but the issue seems to persist.

sballin commented 2 months ago

Sorry to hear that... this was happening to me as well for a brief time and I'm not sure in the end what fixed it. Might have been a macOS update. Maybe try restarting Notes after every time it happens, or restarting your system more often

Cykelero commented 2 months ago

Right, it's likely a Notes bug. Hopefully it'll go away on its own at some point.

And thanks for making this workflow—I use it all the time. Couldn't live without it anymore!