Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prefer my QuickLook plugin

I am making a QuickLook plugin that will be included with my application. It will be used to preview a file type that other applications also have QuickLook plugins for. Every time I attempt to test with my plugin (I put it into ~/Library/QuickLook/) it previews with another app's plugin. I am using qlmanage to preview. Is there a way to force it to use mine, at least for testing?

like image 690
livings124 Avatar asked Jul 28 '12 23:07

livings124


People also ask

How do I install QuickLook plugins?

To install QuickLook plugins, you should copy the “*. qlgenerator” file into /Library/QuickLook/ or ~/Library/QuickLook/. Note that “*” in the filename will vary based on exactly which QuickLook item you choose to install. If a QuickLook folder is not present, feel free to create one.

How do I turn on QuickLook on a Mac?

On your Mac, select one or more items, then press the Space bar. A Quick Look window opens.

Where are QuickLook plugins stored?

QuickLook looks for and uses the plugins from both system-wide folders '/System/Library/QuickLook' and '/Library/QuickLook' and also the home folder of each user in '~/Library/QuickLook'. A QuickLook plugin is organised in a folder with an extension .

How do I fix quick look on my Mac?

The easiest solution to fix macOS Monterey Quick Look not working is to restart Finder. Doing so will also refresh Quick Look as it is part of Finder's feature. To restart Finder, you need to locate the Finder icon on your Dock, right-click it while pressing the Option key, then choose Relaunch.


2 Answers

While the order of precedence described by @julien is accurate, it is still possible to override a particular application's QL provider. Simply edit the Info.plist file in the .qlgenerator of the offending application. For example, I like the way a certain QL provider handles markdown, but one of the text editors I have installed includes (imho) less than stellar markdown support. My preferred bundle loses... until I edit:

/Applications/BadMarkdown.app/Contents/Library/QuickLook/BadMarkdownQL.qlgenerator/Contents/Info.plist

and remove

<string>net.daringfireball.markdown</string>

And in newer versions of OS X, you don't even need to restart the QL daemon. The preferred QL tool just takes over. =D

like image 75
kungfuchicken Avatar answered Oct 19 '22 23:10

kungfuchicken


Generators embedded in applications are always preferred to plug-ins in ~/Library/QuickLook (which are preferred to the ones in /Library/QuickLook, which are preferred to the ones in /System/Library/QuickLook).

There is no way to change this priority. Also if 2 generators at the same level claims the same type of file, Quick Look will prefer one over the other, whichever you can't control.

At least for your test, you can force qlmanage to use the plug-in you want by using the -g option (but you will also have to specify the content-type with -c).

Try qlmanage -h to get all the options for your tests.

like image 33
Julien Avatar answered Oct 20 '22 01:10

Julien