mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-22 15:39:11 +00:00
small fixes
- better window events and handling - better icons for OSX
This commit is contained in:
+22
-17
@@ -40,7 +40,7 @@ const nodePath =
|
|||||||
|
|
||||||
// Load Icons
|
// Load Icons
|
||||||
// TODO: Icons appear pixelated
|
// TODO: Icons appear pixelated
|
||||||
const trayIcon = path.join(__dirname, './assets/images/logos/LOGO-512.png');
|
const trayIcon = path.join(__dirname, './assets/background.png');
|
||||||
const appIcon = path.join(__dirname, './assets/images/logos/LOGO-512.png');
|
const appIcon = path.join(__dirname, './assets/images/logos/LOGO-512.png');
|
||||||
|
|
||||||
function showNotification(text) {
|
function showNotification(text) {
|
||||||
@@ -70,6 +70,7 @@ if (!lock) {
|
|||||||
if (win) {
|
if (win) {
|
||||||
if (win.isMinimized()) win.restore();
|
if (win.isMinimized()) win.restore();
|
||||||
win.show();
|
win.show();
|
||||||
|
win.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -101,7 +102,6 @@ function createWindow() {
|
|||||||
enableWebSQL: false,
|
enableWebSQL: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, './electron/preload.js'),
|
preload: path.join(__dirname, './electron/preload.js'),
|
||||||
// TODO: what are recommended alternatives to node integration?
|
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
enableRemoteModule: true,
|
enableRemoteModule: true,
|
||||||
@@ -109,16 +109,6 @@ function createWindow() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
win.setMenu(null);
|
win.setMenu(null);
|
||||||
|
|
||||||
// Load page served by node
|
|
||||||
const reactApp =
|
|
||||||
env == 'prod'
|
|
||||||
? 'http://localhost:4001/editor'
|
|
||||||
: 'http://localhost:3000/editor';
|
|
||||||
|
|
||||||
win.loadURL(reactApp).then(() => {
|
|
||||||
win.webContents.setBackgroundThrottling(false);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
@@ -145,6 +135,7 @@ app.whenReady().then(() => {
|
|||||||
// bring focus to window
|
// bring focus to window
|
||||||
globalShortcut.register('Alt+1', () => {
|
globalShortcut.register('Alt+1', () => {
|
||||||
win.show();
|
win.show();
|
||||||
|
win.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
globalShortcut.register('Alt+t', () => {
|
globalShortcut.register('Alt+t', () => {
|
||||||
@@ -159,18 +150,29 @@ app.whenReady().then(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
win.once('ready-to-show', () => {
|
// give the nodejs server some time
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
// Load page served by node
|
||||||
|
const reactApp =
|
||||||
|
env == 'prod'
|
||||||
|
? 'http://localhost:4001/editor'
|
||||||
|
: 'http://localhost:3000/editor';
|
||||||
|
|
||||||
|
win.loadURL(reactApp).then(() => {
|
||||||
|
win.webContents.setBackgroundThrottling(false);
|
||||||
|
|
||||||
// window stuff
|
// window stuff
|
||||||
win.show();
|
win.show();
|
||||||
|
win.focus();
|
||||||
|
|
||||||
splash.destroy();
|
splash.destroy();
|
||||||
showNotification(loaded.toString());
|
showNotification(loaded.toString());
|
||||||
|
|
||||||
// tray stuff
|
// tray stuff
|
||||||
// TODO: get IP Address
|
// TODO: get IP Address
|
||||||
tray.setToolTip(loaded);
|
tray.setToolTip(loaded);
|
||||||
}, 2000);
|
});
|
||||||
});
|
}, 2000);
|
||||||
|
|
||||||
// Hide on close
|
// Hide on close
|
||||||
win.on('close', function (event) {
|
win.on('close', function (event) {
|
||||||
@@ -192,7 +194,10 @@ app.whenReady().then(() => {
|
|||||||
const trayMenuTemplate = [
|
const trayMenuTemplate = [
|
||||||
{
|
{
|
||||||
label: 'Show App',
|
label: 'Show App',
|
||||||
click: () => win.show(),
|
click: () => {
|
||||||
|
win.show();
|
||||||
|
win.focus();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Close',
|
label: 'Close',
|
||||||
|
|||||||
Reference in New Issue
Block a user