- Plugin API (plugin.py, context.py, result.py) - Core engine (search.py, manager.py, registry.py, loader.py) - Built-in plugins: app, calculator, clipboard, emoji, power_menu, query, wallpapers - Spotlight docs and example plugins - Spotlight CSS styling
47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
"""Example: simplest possible single-file plugin.
|
|
|
|
Usage:
|
|
cp examples/plugins/hello.py config/plugins/hello.py
|
|
|
|
Then open spotlight and type "hi" or "hello".
|
|
Or deep-reload from terminal:
|
|
fabric-cli exec modus1 'deep_reload hello'
|
|
"""
|
|
|
|
from typing import Any
|
|
|
|
from window.spotlight.api import SearchResult, SpotlightPlugin
|
|
|
|
|
|
class HelloPlugin(SpotlightPlugin):
|
|
id = "hello"
|
|
name = "Hello"
|
|
icon = "face-smile-symbolic"
|
|
keywords = ["hi", "hello"]
|
|
searchable = True
|
|
priority = 100
|
|
|
|
def initialize(self) -> None:
|
|
pass
|
|
|
|
def cleanup(self) -> None:
|
|
pass
|
|
|
|
def search(self, query: str, token: Any) -> list[SearchResult]:
|
|
if not query.strip():
|
|
return []
|
|
return [
|
|
SearchResult(
|
|
id="hello_world",
|
|
title="Hello, World!",
|
|
subtitle="A friendly greeting",
|
|
icon_name="face-smile-symbolic",
|
|
score=100.0,
|
|
render_type="default",
|
|
action=lambda: print("Hello!"),
|
|
)
|
|
]
|
|
|
|
|
|
PLUGIN = HelloPlugin
|