style: format documentation code examples

Align comments in code examples for readability.
This commit is contained in:
sankalp committed 2026-07-28 10:00:41 +05:45
1 parent 3f66c5e55c
commit 88f7f2e125
2 files changed
+18 -16

No files matched your search

+5 -4
View File
@@ -52,10 +52,10 @@ class ExampleClockWidget(Box):
DesktopWidgetRegistry.register( DesktopWidgetRegistry.register(
"example", # unique key (used in desktop.toml) "example", # unique key (used in desktop.toml)
ExampleClockWidget, # GTK widget class ExampleClockWidget, # GTK widget class
(174, 174), # size (width, height) in pixels (174, 174), # size (width, height) in pixels
(0.45, 0.45), # default position (px, py) as 0.0–1.0 fractions (0.45, 0.45), # default position (px, py) as 0.0–1.0 fractions
) )
``` ```
@@ -175,6 +175,7 @@ class LiveClockWidget(Box):
def _update(self) -> bool: def _update(self) -> bool:
import datetime import datetime
now = datetime.datetime.now() now = datetime.datetime.now()
self.label.set_label(now.strftime("%H:%M")) self.label.set_label(now.strftime("%H:%M"))
return True return True
+13 -12
View File
@@ -62,17 +62,17 @@ def search(self, query: str, token: Any) -> list[SearchResult]:
```python ```python
SearchResult( SearchResult(
id="unique_id", # Unique within your plugin id="unique_id", # Unique within your plugin
title="Display Title", # Main text title="Display Title", # Main text
subtitle="Description", # Secondary text subtitle="Description", # Secondary text
icon_name="", # GTK icon name (optional) icon_name="", # GTK icon name (optional)
icon_data=None, # Raw image bytes for custom icons (optional) icon_data=None, # Raw image bytes for custom icons (optional)
score=80.0, # 0-100, higher = better match score=80.0, # 0-100, higher = better match
render_type="default", # Controls rendering (see below) render_type="default", # Controls rendering (see below)
action=lambda: ..., # Called when user selects this result action=lambda: ..., # Called when user selects this result
plugin_name="", # Auto-filled by spotlight plugin_name="", # Auto-filled by spotlight
plugin_id="", # Auto-filled by spotlight plugin_id="", # Auto-filled by spotlight
metadata={}, # Arbitrary data for renderers metadata={}, # Arbitrary data for renderers
) )
``` ```
@@ -159,6 +159,7 @@ class HelloPlugin(SpotlightPlugin):
) )
] ]
PLUGIN = HelloPlugin PLUGIN = HelloPlugin
``` ```
@@ -190,7 +191,7 @@ class GooglePlugin(SpotlightPlugin):
q = query.strip() q = query.strip()
if q: if q:
url = f"https://www.google.com/search?q={urllib.parse.quote(q)}" url = f"https://www.google.com/search?q={urllib.parse.quote(q)}"
spawn_detached(["xdg-open", url]) # no shell injection risk spawn_detached(["xdg-open", url]) # no shell injection risk
PLUGIN = GooglePlugin PLUGIN = GooglePlugin