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.81.tar.gz (74.6 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.81-py3-none-any.whl (56.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wox_plugin-0.0.81.tar.gz
  • Upload date:
  • Size: 74.6 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.81.tar.gz
Algorithm Hash digest
SHA256 964eaa387326a3bb3af42eb7822a079034ac55821484b138cb7989ab554d78a6
MD5 12b6a5a331c5f46a03d92eca32a18dc7
BLAKE2b-256 72b769bd2a2f0ba8faf6cd1a105e8a6e67ea558992184b8ffefa76770494ea7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wox_plugin-0.0.81-py3-none-any.whl
  • Upload date:
  • Size: 56.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.81-py3-none-any.whl
Algorithm Hash digest
SHA256 8874faea76040b7f9ce40c3352923ce06061c91e6e53d5b85496dfd5869b58ec
MD5 c09ac19c1b9daa11663a6f2638c4d3e1
BLAKE2b-256 eb504b61b71456ae5d092ad3c5e485dc574ccc99d03ddf5e33c150f7fe8cbed6

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