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
@@ -657,12 +657,6 @@ class BluetoothConnections(Box):
|
||||
device_slot = BluetoothDeviceSlot(device)
|
||||
self.other_devices.add(device_slot)
|
||||
|
||||
for slot in existing_paired.values():
|
||||
pass
|
||||
|
||||
for slot in existing_other.values():
|
||||
pass
|
||||
|
||||
if not self._destroyed:
|
||||
has_paired_devices = len(paired_devices) > 0
|
||||
has_other_devices = len(other_devices) > 0
|
||||
@@ -679,6 +673,7 @@ class BluetoothConnections(Box):
|
||||
|
||||
def start_device_monitoring(self):
|
||||
"""Start periodic monitoring for device changes"""
|
||||
self.stop_device_monitoring()
|
||||
self.refresh_timer = GLib.timeout_add_seconds(5, self.periodic_device_refresh)
|
||||
|
||||
def stop_device_monitoring(self):
|
||||
|
||||
@@ -7,7 +7,7 @@ from fabric.widgets.label import Label
|
||||
from fabric.widgets.overlay import Overlay
|
||||
|
||||
from services.brightness import Brightness
|
||||
from services.modus import is_caffeine_active, toggle_caffeine
|
||||
from services.inhibit import get_inhibit_service
|
||||
from services.network import NetworkClient
|
||||
from shared.widgets.flat_scale import FlatScale
|
||||
from shared.window.applet_window import AppletWindow
|
||||
@@ -133,11 +133,8 @@ class ModusControlCenter(AppletWindow):
|
||||
h_expand=True,
|
||||
)
|
||||
|
||||
# Only connect brightness controls if brightness service is available
|
||||
if get_brightness_service().max_screen > 0:
|
||||
pass
|
||||
else:
|
||||
# Disable brightness scale if no backlight device available
|
||||
# Disable brightness scale if no backlight device is available
|
||||
if get_brightness_service().max_screen <= 0:
|
||||
self.brightness_scale.set_sensitive(False)
|
||||
|
||||
self._mpris_manager = get_shared_mpris_manager()
|
||||
@@ -722,12 +719,8 @@ class ModusControlCenter(AppletWindow):
|
||||
self.per_app_volume_center_box.set_size_request(300, -1)
|
||||
|
||||
def _check_initial_states(self):
|
||||
self.caffeine_mode = is_caffeine_active()
|
||||
self.caffeine_mode = get_inhibit_service().active
|
||||
self.flight_mode = False
|
||||
GLib.timeout_add(100, self._update_initial_labels)
|
||||
|
||||
def _update_initial_labels(self):
|
||||
return False
|
||||
|
||||
def set_dont_disturb(self, *_):
|
||||
self.focus_mode = not self.focus_mode
|
||||
@@ -770,7 +763,7 @@ class ModusControlCenter(AppletWindow):
|
||||
|
||||
def toggle_caffeine(self, *_):
|
||||
try:
|
||||
self.caffeine_mode = toggle_caffeine()
|
||||
self.caffeine_mode = get_inhibit_service().toggle()
|
||||
self.caffeine_icon.dynamic_file(
|
||||
"applets/caffeine-on.svg"
|
||||
if self.caffeine_mode
|
||||
@@ -1200,11 +1193,6 @@ class ModusControlCenter(AppletWindow):
|
||||
self._cleanup_processes()
|
||||
self._disconnect_signals_when_hidden()
|
||||
|
||||
# Force garbage collection
|
||||
import gc
|
||||
|
||||
gc.collect()
|
||||
|
||||
logger.debug("Complete cleanup finished successfully")
|
||||
|
||||
except Exception as e:
|
||||
|
||||
@@ -11,6 +11,43 @@ from shared.widgets.flat_scale import FlatScale
|
||||
# Local imports
|
||||
from utils.roam import audio_service
|
||||
|
||||
# Mappings used to resolve an app's icon/display name from its description or
|
||||
# name. Defined once at module level to avoid rebuilding on every refresh.
|
||||
_APP_ICON_MAPPING = {
|
||||
"spotify": "spotify",
|
||||
"firefox": "firefox",
|
||||
"chromium": "chromium-browser",
|
||||
"chrome": "google-chrome",
|
||||
"vlc": "vlc",
|
||||
"discord": "discord",
|
||||
"steam": "steam",
|
||||
"zen": "zen-browser",
|
||||
"code": "vscode",
|
||||
"visual studio code": "vscode",
|
||||
"telegram": "telegram-desktop",
|
||||
"pulse": "audio-card",
|
||||
"pipewire": "audio-card",
|
||||
"alsa": "audio-card",
|
||||
"sink": "audio-speakers",
|
||||
"source": "audio-input-microphone",
|
||||
"youtube": "youtube",
|
||||
"music": "rhythmbox",
|
||||
"media": "multimedia-player",
|
||||
}
|
||||
|
||||
_APP_SPECIAL_NAMES = {
|
||||
"spotify": "Spotify",
|
||||
"firefox": "Firefox",
|
||||
"chromium": "Chromium",
|
||||
"chrome": "Chrome",
|
||||
"vlc": "VLC",
|
||||
"discord": "Discord",
|
||||
"steam": "Steam",
|
||||
"zen": "Zen Browser",
|
||||
"code": "VS Code",
|
||||
"telegram": "Telegram",
|
||||
}
|
||||
|
||||
|
||||
class PerAppVolumeControl(Box):
|
||||
"""Per-application volume control widget"""
|
||||
@@ -125,27 +162,7 @@ class PerAppVolumeControl(Box):
|
||||
# Check description first as it's more reliable
|
||||
search_text = app_description if app_description else app_name
|
||||
|
||||
icon_mapping = {
|
||||
"spotify": "spotify",
|
||||
"firefox": "firefox",
|
||||
"chromium": "chromium-browser",
|
||||
"chrome": "google-chrome",
|
||||
"vlc": "vlc",
|
||||
"discord": "discord",
|
||||
"steam": "steam",
|
||||
"zen": "zen-browser",
|
||||
"code": "vscode",
|
||||
"visual studio code": "vscode",
|
||||
"telegram": "telegram-desktop",
|
||||
"pulse": "audio-card",
|
||||
"pipewire": "audio-card",
|
||||
"alsa": "audio-card",
|
||||
"sink": "audio-speakers",
|
||||
"source": "audio-input-microphone",
|
||||
"youtube": "youtube",
|
||||
"music": "rhythmbox",
|
||||
"media": "multimedia-player",
|
||||
}
|
||||
icon_mapping = _APP_ICON_MAPPING
|
||||
|
||||
# Check if any key in mapping is contained in search text
|
||||
for key, icon in icon_mapping.items():
|
||||
@@ -167,22 +184,9 @@ class PerAppVolumeControl(Box):
|
||||
return "Unknown"
|
||||
|
||||
# Handle common app names specially
|
||||
special_names = {
|
||||
"spotify": "Spotify",
|
||||
"firefox": "Firefox",
|
||||
"chromium": "Chromium",
|
||||
"chrome": "Chrome",
|
||||
"vlc": "VLC",
|
||||
"discord": "Discord",
|
||||
"steam": "Steam",
|
||||
"zen": "Zen Browser",
|
||||
"code": "VS Code",
|
||||
"telegram": "Telegram",
|
||||
}
|
||||
|
||||
name_lower = name.lower()
|
||||
if name_lower in special_names:
|
||||
return special_names[name_lower]
|
||||
if name_lower in _APP_SPECIAL_NAMES:
|
||||
return _APP_SPECIAL_NAMES[name_lower]
|
||||
|
||||
# Default: capitalize first letter
|
||||
return name.capitalize()
|
||||
|
||||
@@ -631,6 +631,7 @@ class WifiConnections(Box):
|
||||
|
||||
def start_network_monitoring(self):
|
||||
"""Start periodic monitoring for network changes"""
|
||||
self.stop_network_monitoring()
|
||||
self.refresh_timer = GLib.timeout_add_seconds(5, self.periodic_network_refresh)
|
||||
|
||||
def stop_network_monitoring(self):
|
||||
|
||||
Reference in new issue
Block a user