Skip to main content

Python plugin SDK for Wox launcher

Project description

Wox Plugin Python

This package provides type definitions for developing Wox plugins in Python.

Requirements

  • Python >= 3.8 (defined in pyproject.toml)
  • Python 3.12 recommended for development (defined in .python-version)

Installation

# Using pip
pip install wox-plugin

# Using uv (recommended)
uv add wox-plugin

Usage

This example returns QueryResponse, so the plugin's plugin.json should set MinWoxVersion to 2.0.4 or newer. Return list[Result] directly if you need the same plugin build to run on older Wox releases.

from wox_plugin import Query, QueryResponse, Result, Context, PluginInitParams, WoxImage

class MyPlugin:
    async def init(self, ctx: Context, params: PluginInitParams) -> None:
        self.api = params.API
        
    async def query(self, ctx: Context, query: Query) -> QueryResponse:
        # Your plugin logic here
        results = []
        results.append(
            Result(
                title="Hello Wox",
                sub_title="This is a sample result",
                icon=WoxImage.new_emoji("🔍"),
                score=100
            )
        )
        return QueryResponse(results=results)

# MUST HAVE! The plugin class will be automatically loaded by Wox
plugin = MyPlugin()

Returning list[Result] directly is deprecated. The Python host still accepts it for compatibility with older Wox releases. Use QueryResponse only when plugin.json declares MinWoxVersion >= 2.0.4 so results, refinements, and layout hints are carried together.

When a plugin needs to control the preview width or grid layout, set QueryResponse.layout.result_preview_width_ratio or QueryResponse.layout.grid_layout. The older resultPreviewWidthRatio and gridLayout metadata features are deprecated because they can only describe static plugin or command defaults.

Query Requirements

Plugins can declare settings that must be configured before Wox calls query():

{
  "QueryRequirements": {
    "AnyQuery": [
      {
        "SettingKey": "apiKey",
        "Validators": [{ "Type": "not_empty" }],
        "Message": "i18n:my_plugin_api_key_required"
      }
    ],
    "QueryWithoutCommand": [],
    "QueryWithCommand": {
      "download": [
        {
          "SettingKey": "downloadPath",
          "Validators": [{ "Type": "not_empty" }]
        }
      ]
    }
  }
}

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wox_plugin-0.0.80.tar.gz (74.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wox_plugin-0.0.80-py3-none-any.whl (55.4 kB view details)

Uploaded Python 3

File details

Details for the file wox_plugin-0.0.80.tar.gz.

File metadata

  • Download URL: wox_plugin-0.0.80.tar.gz
  • Upload date:
  • Size: 74.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.16

File hashes

Hashes for wox_plugin-0.0.80.tar.gz
Algorithm Hash digest
SHA256 361af556fabf316e28da9ce5f92441328a89cbfaa622117b7a6a69983ee2fd04
MD5 b4444b2d5dcc904d3b82fab03b0f57b7
BLAKE2b-256 f5bd246986067b49fadd4dbe703a3938c82859132f25216475ece916e620609d

See more details on using hashes here.

File details

Details for the file wox_plugin-0.0.80-py3-none-any.whl.

File metadata

  • Download URL: wox_plugin-0.0.80-py3-none-any.whl
  • Upload date:
  • Size: 55.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.16

File hashes

Hashes for wox_plugin-0.0.80-py3-none-any.whl
Algorithm Hash digest
SHA256 80e73f3204d986f0e89f934df32d8a1c79317613c3d57c7222796d9e4abc3a77
MD5 f39009e727ca4bc8aba4167cc21766ac
BLAKE2b-256 ba121b429a2020f9aeb51c91bd21e20fab3bd87ddb42a382b06d6d890d71c280

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page