🧰
Tray
We allow you to add to the system's tray (notification area)
The Tray is the area where applications can put their icons to be easily accessed by users. On macOS this is the menubar and on Windows it's the system tray.
Works on macOS only. Will throw on Windows & Linux
todesktop.tray.setTitle('title')
This will destroy the tray item immediately
todesktop.tray.destroy()
Suppose we wanted to show users a 60 second timer in the tray
function startTimer () {
let remainingTime = 60;
let timer = setInterval(() => {
// Set the tray title to the remaining time
window.todesktop.tray.setTitle(
`Remaining: ${remainingTime}`
);
remainingTime -= 1;
if (remainingTime < 0) clearInterval(timer);
}, 1000);
}
This will give you something like:
