mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Move toast IPC closer to notifications
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user