Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
Nate Parrott edited this pageApr 30, 2015 ·7 revisions

Looking for a step-by-step guide to creating plugins?Look here.

Supportedinfo.json Keys

  • name Thismust be the same as the name of your plugin bundle (minus the.bundle extension)
  • displayName
  • description
  • examples (array of strings)
  • categories (array of categories. See the app for category names. Category names should have their first-letter capitalized, exactly how they appear in the English version of the app.)
  • description_fr,displayName_zh,examples_de, etc — append country codes to keys (in addition to their english versions, which shouldnot haveen appended). SeeInternationalization

plugin.py Interface

Method:results(parsed, original_query)

parsed:{String: String} dictionary mapping tagged sections of the query (extracted using the examples inexamples.txt), to the text they contain.

original_query:string

Return value:A json dictionary containing any of the following keys:

  • title: result title in Spotlight
  • html: html to show inline in Spotlight
  • run_args: arguments to be passed to therun() function (described below) if your result is clicked or enter is pressed. Must be JSON-serializable.
  • webview_links_open_in_browser: clicking links in Spotlight opens the browser
  • dont_force_top_hit: don't force this result to be to #1 hit in Spotlight
  • webview_user_agent: custom user agent for the webview (useful for forcing a mobile view of a site)
  • webview_transparent_background: give the webview a transparent background. You'll probably want to use thedark_mode module to detect Yosemite dark mode and adjust your CSS.
  • pass_result_of_output_function_as_first_run_arg: calls any function in your webview's Javascript namedoutput(), and passes the resulting JSON-serializable object as the first argument to yourrun() function

Method:run(...)

Called with all arguments fromrun_args. This process has about ~20 seconds to run before being killed; spawn a new process for long-running work.

Javascript API

When you return HTML and Javascript from yourresults function, it has available to it a special Javascript object calledflashlight. It's got a single method:bash(script): executes a string as a bash script, and returns thestdout result to Javascript.Only available for local HTML, not remote sites.Note: in your local HTML, you can make cross-siteAJAX requests. This is, again not available to remote pages running inside Spotlight.

Settings API

Your plugin can show a settings screen for infrequently-changed settings and configuration. Seethe Settings API docs

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp