Add OS notification listener for Windows toast capture

Polls Windows notifications via winsdk UserNotificationListener API
and fires matching notification CSS streams with os_listener=True.
Includes history API endpoint for tracking captured notifications.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 21:57:29 +03:00
parent 42280f094a
commit bf212c86ec
3 changed files with 208 additions and 0 deletions

View File

@@ -570,6 +570,19 @@ async def notify_source(
}
@router.get("/api/v1/color-strip-sources/os-notifications/history", tags=["Color Strip Sources"])
async def os_notification_history(_auth: AuthRequired):
"""Return recent OS notification capture history (newest first)."""
from wled_controller.core.processing.os_notification_listener import get_os_notification_listener
listener = get_os_notification_listener()
if listener is None:
return {"available": False, "history": []}
return {
"available": listener._available,
"history": listener.recent_history,
}
@router.websocket("/api/v1/color-strip-sources/{source_id}/ws")
async def css_api_input_ws(
websocket: WebSocket,