Move toast IPC closer to notifications

This commit is contained in:
Thibault Martin
2026-03-25 12:06:54 +01:00
parent e4158c7d81
commit af7fd3bad2
+28 -28
View File
@@ -256,6 +256,34 @@ Singleton {
}
}
IpcHandler {
target: "toast"
function send(json: string) {
try {
var data = JSON.parse(json);
var title = data.title || "";
var body = data.body || "";
var icon = data.icon || "";
var type = data.type || "notice";
var duration = data.duration;
switch (type) {
case "warning":
ToastService.showWarning(title, body, duration ?? 4000);
break;
case "error":
ToastService.showError(title, body, duration ?? 6000);
break;
default:
ToastService.showNotice(title, body, icon, duration ?? 3000);
}
} catch (error) {
Logger.e("IPC", "Failed to parse toast JSON: " + error);
}
}
}
// Idle Inhibitor / Keep Awake
IpcHandler {
target: "idleInhibitor"
@@ -731,34 +759,6 @@ Singleton {
}
}
IpcHandler {
target: "toast"
function send(json: string) {
try {
var data = JSON.parse(json);
var title = data.title || "";
var body = data.body || "";
var icon = data.icon || "";
var type = data.type || "notice";
var duration = data.duration;
switch (type) {
case "warning":
ToastService.showWarning(title, body, duration ?? 4000);
break;
case "error":
ToastService.showError(title, body, duration ?? 6000);
break;
default:
ToastService.showNotice(title, body, icon, duration ?? 3000);
}
} catch (error) {
Logger.e("IPC", "Failed to parse toast JSON: " + error);
}
}
}
IpcHandler {
target: "media"