Coder Social home page Coder Social logo

leiless / quicklook_plugin Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 0.0 59 KB

Makefile of a barebone Quick Look plugin

License: BSD 2-Clause "Simplified" License

Makefile 27.90% Objective-C 17.21% C 54.89%
quicklook quicklook-plugin quicklook-bundle

quicklook_plugin's Introduction

ExampleQL - Makefile for macOS Quick Look plugin

ExampleQL is a Makefile for a barebone Quick Look plugin, without Xcode project intervention.

Theoretically, this plugin can be run in macOS >= 10.5, yet only tested in macOS [10.10, 10.14] If you tested it under macOS 10.10, please let me know.


Mandatory variables

You must define at least following Makefile variables in Makefile.inc

PLUGIN_NAME

PLUGIN_VERSION

PLUGIN_BUILD

# Reversed domain  Example: com.example
BUNDLE_DOMAIN

# Supported UTI types to generate preview/thumbnail
PLUGIN_SUPPORTED_UTI

Optional variables

You may alternatively specify following variables(default value will be used if not specified)

# Plugin bundle identifier
PLUGIN_BID

# Supported architectures
ARCHFLAGS

# Quick Look installation prefix
PREFIX

# macOS SDK root path
SDKROOT

# Minimal supported macOS version(should >= 10.5)
MACOSX_VERSION_MIN

# Copyright string embedded in Info.plist
COPYRIGHT

# Code signature identity
SIGNCERT

For a full list of optional variables, please check Makefile

Compile & load

# Use `release' target for release build; default is `debug'
make

mkdir -p ~/Library/QuickLook
cp -r ExampleQL.qlgenerator ~/Library/QuickLook

# Reset Quick Look Server
qlmanage -r cache
qlmanage -r

# Check if this Quick Look loaded
qlmanage -m plugins | grep ExampleQL

In side Finder, open a directory with supported-UTI files, so your Quick Look plugin can be invoked to generate thumbnail/preview.

Alternatively, you can use qlmanage(1) command line utility to generate thumbnail/preview manually.

Debugging & test

# for macOS >= 10.13
log stream --style compact --predicate 'process == "QuickLookSatellite" AND eventMessage CONTAINS "ExampleQL"' --color=auto

# for macOS >= 10.12
log stream --style compact --predicate 'process == "QuickLookSatellite" AND eventMessage CONTAINS "ExampleQL"'

# for macOS < 10.12
syslog -w 0 -k Sender QuickLookSatellite -k Message S ExampleQL

Please check Debugging and Testing a Generator for a comprehensive debugging tips.

Install/uninstall

# Install/uninstall Quick Look plugin for current user
make install
make uninstall

# Install/uninstall Quick Look plugin for all users
PREFIX=/Library/QuickLook sudo make install
PREFIX=/Library/QuickLook sudo make uninstall

Caveats

  • This Quick Look plugin was written in Objective-C & C.

  • main.c contains the generic CFPlug-in code necessary for a Quick Look generator to use, don't touch it.

  • Mojave(10.14) is the last macOS release to support 32-bit apps, Apple LLVM 10.0.0 and above don't support i386 architecture, thus you should eliminate -arch i386 in ARCHFLAGS for 10.14 and above.

    Apple LLVM 10.0.0 and above drop library linkage with gcc_s.10.5(need confirmation), you should specify MACOSX_VERSION_MIN=10.6 before make(or declare it in Makefile.inc)

    # Make example for macOS 10.14 Mojave and above
    MACOSX_VERSION_MIN=10.6 ARCHFLAGS="-arch x86_64" make [release]

References

Introduction to Quick Look Programming Guide

sindresorhus/quick-look-plugins

phracker/MacOSX-SDKs

QuickLook Plugins List


Created 190121+0800

quicklook_plugin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.