refract: update notification style

Notifications title is app (windows)
notifications now have title and message
This commit is contained in:
cv
2021-10-23 22:30:00 +02:00
parent 6ca2eb77a1
commit 759dece70f
+9 -5
View File
@@ -42,9 +42,9 @@ const nodePath =
const trayIcon = path.join(__dirname, './assets/background.png');
const appIcon = path.join(__dirname, './assets/logo.png');
function showNotification(text) {
function showNotification(title, text) {
new Notification({
title: 'ontime',
title: title,
body: text,
silent: true,
}).show();
@@ -113,6 +113,11 @@ function createWindow() {
}
app.whenReady().then(() => {
// Set app title in windows
if (process.platform === 'win32') {
app.setAppUserModelId(app.name);
}
createWindow();
// register global shortcuts
@@ -151,7 +156,6 @@ app.whenReady().then(() => {
win.focus();
splash.destroy();
showNotification(loaded.toString());
// tray stuff
// TODO: get IP Address
@@ -163,7 +167,7 @@ app.whenReady().then(() => {
win.on('close', function (event) {
event.preventDefault();
if (!isQuitting) {
showNotification('App running in background');
showNotification('Window Closed', 'App running in background');
win.hide();
return false;
}
@@ -209,7 +213,7 @@ app.once('before-quit', () => {
// Get messages from react
// Test message
ipcMain.on('test-message', (event, arg) => {
showNotification('testing 1-2', arg);
showNotification('Test Message', 'test from react', arg);
});
// Terminate