Jump to content

Multiple Script Filter QuickLook bugs [Fixed 4.5]


vitor

Recommended Posts

I started by reporting one bug and in the process found two more. Making a single thread for them, as they’re all related to QuickLook inside Script Filters. I’ll post one reply per bug for simplicity. They can all the reproduced with the same Workflow. It’s very simple, just a Script Filter connected to an Open URL. The Script Filter’s code is:

 

echo '{ "items": [
  { "title": "Example", "arg": "https://example.com" },
  { "title": "Alfredapp", "arg": "https://www.alfredapp.com" },
  { "title": "Wikipedia", "arg": "https://en.wikipedia.org/wiki/Main_Page" },
  { "title": "DuckDuckGo", "arg": "https://duckduckgo.com" }
] }'

 

Quick Links:

 

Bug 1
Bug 2
Bug 3

Edited by vitor
Added quick links to the bug posts
Link to comment
Share on other sites

Bug 1


Run qlbug. Then move down to another result and press ⇧ or ⌘Y to see a quicklook preview of the page. While the preview is open, press ↵. It will open the webpage (this is not important, you can close the tab). Now the kicker: open Alfred and press ↑ to rerun the last command, and the actioned result will be at the top!


If you keep repeating this, the selected results will pile up at the top. It almost seems like intended behaviour, except:

  • If the quicklook preview is not active at the time the result is actioned, the behaviour will not happen.1
  • If you set it to “Don’t close the Alfred window on actioning result”, the behaviour will not happen.
  • If instead of ↑ you retype the same command, the behaviour will not happen.
  • No result has a uid.

The combination of all these is what makes me think it’s a bug and not intended behaviour.




1. Even if you had gathered multiple results at the top, actioning another without QuickLook will undo the behaviour.

Link to comment
Share on other sites

Bug 2


Make one small change to the Workflow. Double click the Script Filter → Open URL connection and select “Don’t close the Alfred window on actioning result”.


Now run qlbug. ⇧ or ⌘Y any result to see a preview. Press ↵. Three things will happen:

  • A webpage will open.
  • Alfred’s window will remain open.
  • QuickLook will be dismissed.

Now move to a different result then press ⇧ or ⌘Y. It will not work! You’ll need to press it a second time for it to appear. However, if instead you stay on the same result, pressing ⇧ or ⌘Y will work and show the preview.

Link to comment
Share on other sites

Bug 3


Keep the modification from step 2. I.e. “Don’t close the Alfred window on actioning result” has to remain.


Run qlbug. ⇧ or ⌘Y any result to see a preview. Stay on the same result or move to another; it does not matter. Press ↵. Again, three things will happen:

  • A webpage will open.
  • Alfred’s window will remain open.
  • QuickLook will be dismissed.

Now press ↵ on any result, it doesn’t matter if it’s the same or you moved. Alfred’s window will be dismissed.


But this bug has a few more tricks up its sleeve! Because even if you dismiss QuickLook the first time before pressing ↵, Alfred’s window will disappear.

Link to comment
Share on other sites

I'll read this properly and look into this next week, but one thing to consider is that "Don’t close the Alfred window on actioning result" only means Alfred won't internally close the window after actioning the result. It's still entirely possible that macOS will take focus and close the window away from Alfred which will cause the window to close.

Link to comment
Share on other sites

2 minutes ago, Andrew said:

I'll read this properly and look into this next week

 

Have a nice weekend!

 

6 minutes ago, Andrew said:

but one thing to consider is that

 

Yep, that might be relevant for Bug 3 but from my tests it depends entirely on if QuickLook was actioned and dismissed or not. I wouldn’t be surprised it it were Apple’s bug, but it seems related to whatever causes Bug 2 (which, again, may be Apple’s fault, but perhaps it’s workaroundable).

Link to comment
Share on other sites

Bug 1 was an interesting logic issue. Alfred was cleaning up the results when the key window resigned, but this logic was skipped due to the fact that the key window gets resigned when the QL view is shown (and Alfred naturally ignores this as we want him to stay open). I have moved the cleanup logic into a better place.

 

Bug 2 - This has been really quite an interesting investigation into some of Alfred's keyboard event handling, and it looks to possibly be a bug outside of Alfred's control. Having said that, I am confident that I've found a workaround for what was happening here, and this will be fixed in a future release.

 

With Bug 3, it seems that, for whatever reason, after a QL window has been show, it changes the underlying macOS behaviour such that focus is pulled from Alfred making the close happen. There unfortunately doesn't seem to be an obvious workaround for this.

 

Link to comment
Share on other sites

15 minutes ago, Andrew said:

There unfortunately doesn't seem to be an obvious workaround for this.

 

How about embedding the Quick Look preview in your own window?

 

Genuine bugs aside, Quick Look's behaviour is pretty janky. Unlike just about everything else, it doesn't seem to remember window size and position. When I open it, it always at least partially obscures Alfred's own window, which is annoying because there's plenty of room for it elsewhere on a 27" screen.

Edited by deanishe
Link to comment
Share on other sites

17 minutes ago, deanishe said:

 

The last time I implemented this to give it another go, it made Alfred use a significant amount of memory which was never fully released. It's the same reason Alfred doesn't use WebKit. There are other alternatives, like running the QuickLook (in whatever guise) in a separate process which gets quit after.

 

I'll keep this in mind for the future, as I don't want to get sidetracked at the moment for Alfred 4.5.

Link to comment
Share on other sites

  • Andrew changed the title to Multiple Script Filter QuickLook bugs [Fixed 4.5]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...