From 5f01d9bdac7310a90c2d2cf4a176a0cd0ca20c3b Mon Sep 17 00:00:00 2001 From: Royce Schultz Date: Thu, 16 May 2024 14:50:32 -0600 Subject: [PATCH] Adds custom body text option for system notification. --- nodes/system_notification.py | 5 +++-- web/system_notification.js | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nodes/system_notification.py b/nodes/system_notification.py index ba67755..afb1531 100644 --- a/nodes/system_notification.py +++ b/nodes/system_notification.py @@ -7,6 +7,7 @@ class SystemNotification: "required": { "any": (ComfyAnyType("*"), {}), "mode": (["always", "on empty queue"], {}), + "notification_text": ('STRING', {'default': 'Your notification has triggered.'}), }, } @@ -15,5 +16,5 @@ class SystemNotification: RETURN_TYPES = tuple() CATEGORY = "notifications" - def nop(self, any, mode): - return {"ui": {"a": []}, "result": (0, )} + def nop(self, any, mode, notification_text): + return {"ui": {"notification_text": [notification_text]}, "result": (0, )} diff --git a/web/system_notification.js b/web/system_notification.js index f09e92d..5249954 100644 --- a/web/system_notification.js +++ b/web/system_notification.js @@ -33,7 +33,8 @@ app.registerExtension({ } } if (!notificationSetup()) return; - const notification = new Notification("ComfyUI", { body: "Your notification has triggered." }) + const notification_text = arguments[0]?.notification_text[0] ?? "Your notification has triggered." + const notification = new Notification("ComfyUI", { body: notification_text }) }; const onNodeCreated = nodeType.prototype.onNodeCreated;