fix(services/spotlight): improve MPRIS artwork handling and scope keyword searches to single plugin
- mpris: native MediaArt cache lookup, dedupe play/pause emission, safe cleanup, artwork polling for already-playing browser players, drop os.system seek fallback - spotlight: scope plugin keyword and detect() matches to a single plugin via search_single instead of global search; register clipboard keywords (clip/clipboard)
This commit is contained in:
43 files changed
+1227
-637
No files matched your search
@@ -69,12 +69,6 @@ class Panel(Window):
|
||||
self.tray.connect("add", self._update_tray_visibility)
|
||||
self.tray.connect("remove", self._update_tray_visibility)
|
||||
|
||||
self.indicators = Box(
|
||||
name="indicators",
|
||||
orientation="h",
|
||||
spacing=4,
|
||||
)
|
||||
|
||||
self._spotlight_toggle_cb = None
|
||||
self.search = Button(
|
||||
name="panel-button",
|
||||
|
||||
@@ -334,9 +334,24 @@ class MicrophoneIndicator(Box):
|
||||
self._connect_mic_signals()
|
||||
|
||||
def _connect_mic_signals(self):
|
||||
if self._audio.microphone:
|
||||
self._audio.microphone.connect("changed", self._on_mic_stream_changed)
|
||||
self._sync_state()
|
||||
mic = self._audio.microphone
|
||||
if mic is None:
|
||||
return
|
||||
# Disconnect from a previously-connected device if it changed, and
|
||||
# avoid stacking duplicate handlers on the same device.
|
||||
old = getattr(self, "_mic_device", None)
|
||||
if old is not None and old is not mic:
|
||||
try:
|
||||
old.disconnect_by_func(self._on_mic_stream_changed)
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
mic.disconnect_by_func(self._on_mic_stream_changed)
|
||||
except Exception:
|
||||
pass
|
||||
mic.connect("changed", self._on_mic_stream_changed)
|
||||
self._mic_device = mic
|
||||
self._sync_state()
|
||||
|
||||
def _on_mic_device_changed(self, *_):
|
||||
self._connect_mic_signals()
|
||||
@@ -371,8 +386,13 @@ class MicrophoneIndicator(Box):
|
||||
self._hide_timer_id = 0
|
||||
try:
|
||||
self._audio.disconnect_by_func(self._on_mic_device_changed)
|
||||
if self._audio.microphone:
|
||||
self._audio.microphone.disconnect_by_func(self._on_mic_stream_changed)
|
||||
except Exception as e:
|
||||
logger.warning(f"[NotchIndicators] mic disconnect: {e}")
|
||||
except Exception:
|
||||
pass
|
||||
old = getattr(self, "_mic_device", None)
|
||||
target = old if old is not None else self._audio.microphone
|
||||
if target is not None:
|
||||
try:
|
||||
target.disconnect_by_func(self._on_mic_stream_changed)
|
||||
except Exception as e:
|
||||
logger.warning(f"[NotchIndicators] mic disconnect: {e}")
|
||||
super().destroy()
|
||||
@@ -188,6 +188,12 @@ class Notch(Box):
|
||||
def _on_player_vanish(self, _manager, name: str):
|
||||
if name in self._music_services:
|
||||
self._music_services.remove(name)
|
||||
try:
|
||||
svc = self._mpris.get_player_service(name)
|
||||
if svc is not None:
|
||||
svc.disconnect_by_func(self._on_any_artwork)
|
||||
except Exception:
|
||||
pass
|
||||
self._apply_stack_state()
|
||||
|
||||
# ── Scroll ────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user