feat(spotlight): add plugin system with core engine and examples

- 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
This commit is contained in:
sankalp committed 2026-07-12 20:17:34 +05:45
1 parent 795e259e16
commit 3a81ab1212
24 files changed
+3130 -20

No files matched your search

+2 -20
View File
@@ -97,10 +97,7 @@ class Spotlight(Box):
self.children = self.header, self.scrolled_clip
# ------------------------------------------------------------------
# Search
# ------------------------------------------------------------------
@debounce(200)
def on_entry_changed(self, entry: Entry, *_):
if getattr(entry, "_ignore_change", False):
@@ -246,10 +243,7 @@ class Spotlight(Box):
self._post_arrange()
# ------------------------------------------------------------------
# Rendering
# ------------------------------------------------------------------
def _render_result(self, result: SearchResult) -> Button:
rt = result.render_type
if rt == "app":
@@ -511,10 +505,7 @@ class Spotlight(Box):
result.action()
self.launched()
# ------------------------------------------------------------------
# Viewport management
# ------------------------------------------------------------------
def _clear_viewport(self):
old_results = self._current_results
self._current_results = []
@@ -569,10 +560,7 @@ class Spotlight(Box):
if self.viewport.children:
self.set_selected_index(0)
# ------------------------------------------------------------------
# Selection & keyboard
# ------------------------------------------------------------------
def on_slot_enter(self, button, event):
children = self.viewport.children
if button in children:
@@ -611,10 +599,7 @@ class Spotlight(Box):
return True
return False
# ------------------------------------------------------------------
# Submit
# ------------------------------------------------------------------
def on_entry_accept(self, entry: Entry, *_):
if 0 <= self._selected_index < len(self.viewport.children):
widget = self.viewport.children[self._selected_index]
@@ -632,10 +617,7 @@ class Spotlight(Box):
if self._current_results:
self._activate_result(self._current_results[0])
# ------------------------------------------------------------------
# External commands
# ------------------------------------------------------------------
def handle_external(self, command: str, text: str = "") -> bool:
if command == "deep_reload" and text:
return self.plugin_service.manager.deep_reload(text.strip())
@@ -662,10 +644,10 @@ class SpotlightWindow(Window):
)
super().__init__(
name="spotlight-window",
title="fabric-spotlight",
title="modus-spotlight",
anchor="top",
margin="80px 0px 0px 0px",
keyboard_mode="on-demand",
keyboard_mode="exclusive",
child=self.spotlight_box,
visible=False,
all_visible=False,