diff --git a/src/gui/src/UI/UIDesktop.js b/src/gui/src/UI/UIDesktop.js index 20f5415e..86c97f35 100644 --- a/src/gui/src/UI/UIDesktop.js +++ b/src/gui/src/UI/UIDesktop.js @@ -46,6 +46,13 @@ import UIWindowSearch from "./UIWindowSearch.js" async function UIDesktop(options){ let h = ''; + // Set up the desktop channel for communication between different tabs in the same browser + window.channel = new BroadcastChannel('puter-desktop-channel'); + channel.onmessage = function(e){ + } + + // channel.postMessage({'hello': 'world'}); + // connect socket. window.socket = io(window.gui_origin + '/', { auth: { @@ -122,6 +129,7 @@ async function UIDesktop(options){ text: notification.text, icon: icon, value: notification, + uid, close: async () => { await fetch(`${window.api_origin}/notif/mark-ack`, { method: 'POST', @@ -160,6 +168,7 @@ async function UIDesktop(options){ icon, title: notification.title, text: notification.text ?? notification.title, + uid: notif_info.uid, close: async () => { await fetch(`${window.api_origin}/notif/mark-ack`, { method: 'POST', @@ -176,6 +185,10 @@ async function UIDesktop(options){ } }); + window.socket.on('notif.ack', ({ uid }) => { + $(`.notification[data-uid="${uid}"]`).remove(); + }); + window.socket.on('app.opened', async (app) => { // don't update if this is the original client that initiated the action if(app.original_client_socket_id === window.socket.id) diff --git a/src/gui/src/UI/UINotification.js b/src/gui/src/UI/UINotification.js index 587d0a81..47828b99 100644 --- a/src/gui/src/UI/UINotification.js +++ b/src/gui/src/UI/UINotification.js @@ -22,7 +22,7 @@ function UINotification(options){ options.text = options.text ?? ''; let h = ''; - h += `