Refactor process picker into palette pattern, add notification app picker
- Refactor process-picker.ts into generic NamePalette with two concrete instances: ProcessPalette (running processes) and NotificationAppPalette (OS notification history apps) - Notification color strip app colors and filter list now use NotificationAppPalette (shows display names like "Telegram" instead of process names like "telegram.exe") - Fix case-insensitive matching for app_colors and app_filter_list in notification_stream.py - Compact browse/remove buttons in notification app color rows with proper search icon - Remove old inline process-picker HTML/CSS (replaced by palette overlay) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -68,9 +68,9 @@ class NotificationColorStripStream(ColorStripStream):
|
||||
self._notification_effect = getattr(source, "notification_effect", "flash")
|
||||
self._duration_ms = max(100, int(getattr(source, "duration_ms", 1500)))
|
||||
self._default_color = getattr(source, "default_color", "#FFFFFF")
|
||||
self._app_colors = dict(getattr(source, "app_colors", {}))
|
||||
self._app_colors = {k.lower(): v for k, v in dict(getattr(source, "app_colors", {})).items()}
|
||||
self._app_filter_mode = getattr(source, "app_filter_mode", "off")
|
||||
self._app_filter_list = list(getattr(source, "app_filter_list", []))
|
||||
self._app_filter_list = [a.lower() for a in getattr(source, "app_filter_list", [])]
|
||||
self._auto_size = not getattr(source, "led_count", 0)
|
||||
self._led_count = getattr(source, "led_count", 0) if getattr(source, "led_count", 0) > 0 else 1
|
||||
with self._colors_lock:
|
||||
@@ -86,9 +86,12 @@ class NotificationColorStripStream(ColorStripStream):
|
||||
Returns:
|
||||
True if the notification was accepted, False if filtered out.
|
||||
"""
|
||||
# Normalize app name for case-insensitive matching
|
||||
app_lower = app_name.lower() if app_name else None
|
||||
|
||||
# Check app filter
|
||||
if app_name and self._app_filter_mode != "off":
|
||||
in_list = app_name in self._app_filter_list
|
||||
if app_lower and self._app_filter_mode != "off":
|
||||
in_list = app_lower in self._app_filter_list
|
||||
if self._app_filter_mode == "whitelist" and not in_list:
|
||||
return False
|
||||
if self._app_filter_mode == "blacklist" and in_list:
|
||||
@@ -97,8 +100,8 @@ class NotificationColorStripStream(ColorStripStream):
|
||||
# Resolve color: override > app_colors[app_name] > default_color
|
||||
if color_override:
|
||||
color = _hex_to_rgb(color_override)
|
||||
elif app_name and app_name in self._app_colors:
|
||||
color = _hex_to_rgb(self._app_colors[app_name])
|
||||
elif app_lower and app_lower in self._app_colors:
|
||||
color = _hex_to_rgb(self._app_colors[app_lower])
|
||||
else:
|
||||
color = _hex_to_rgb(self._default_color)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user