improve the launcher and application switcher, now laucher become plugin based fully

This commit is contained in:
sankalp committed 2025-06-17 23:51:51 +05:45
1 parent 9e598319a7
commit 3774544484
34 files changed
+3085 -768

No files matched your search

+13 -10
View File
@@ -2,10 +2,10 @@
Result class representing a search result from plugins.
"""
from typing import Optional, Callable, Any
from dataclasses import dataclass
from gi.repository import GdkPixbuf
import utils.icons as icons
from typing import Any, Callable, Optional
from gi.repository import GdkPixbuf, Gtk
@dataclass
@@ -13,7 +13,7 @@ class Result:
"""
Represents a search result that can be displayed and activated.
"""
# Display information
title: str
subtitle: str = ""
@@ -24,29 +24,32 @@ class Result:
# Behavior
action: Optional[Callable[[], Any]] = None
relevance: float = 0.0
# Custom widget support
custom_widget: Optional[Gtk.Widget] = None
# Metadata
plugin_name: str = ""
data: Optional[dict] = None
def activate(self):
"""Activate this result (execute its action)."""
if self.action:
return self.action()
else:
raise NotImplementedError("No action defined for this result")
def __post_init__(self):
"""Post-initialization processing."""
# Ensure relevance is within valid range
self.relevance = max(0.0, min(1.0, self.relevance))
# Set default data if None
if self.data is None:
self.data = {}
def __str__(self):
return f"Result(title='{self.title}', relevance={self.relevance})"
def __repr__(self):
return self.__str__()