mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 18:33:59 +01:00
parent
90a4e3669b
commit
815bb19c72
|
@ -1,6 +1,6 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const { app, BrowserWindow } = require('electron');
|
const { app, BrowserWindow, Tray, Menu } = require('electron');
|
||||||
const isDev = require('electron-is-dev');
|
const isDev = require('electron-is-dev');
|
||||||
const { autoUpdater } = require('electron-updater');
|
const { autoUpdater } = require('electron-updater');
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ if (require('electron-squirrel-startup')) app.quit();
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
let iconPath = '';
|
let iconPath = '';
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
iconPath = path.join(__dirname, '../public/favicon-516x516.png');
|
iconPath = path.join(__dirname, '../public/icon-rounded.png');
|
||||||
} else {
|
} else {
|
||||||
iconPath = path.join(__dirname, '../dist/favicon-516x516.png');
|
iconPath = path.join(__dirname, '../dist/icon-rounded.png');
|
||||||
}
|
}
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
|
|
||||||
|
@ -19,6 +19,14 @@ function createWindow() {
|
||||||
show: false,
|
show: false,
|
||||||
icon: iconPath,
|
icon: iconPath,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
createTray(win);
|
||||||
|
|
||||||
|
win.on('minimize', (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
win.hide();
|
||||||
|
});
|
||||||
|
|
||||||
win.maximize();
|
win.maximize();
|
||||||
win.show();
|
win.show();
|
||||||
|
|
||||||
|
@ -31,8 +39,35 @@ function createWindow() {
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
win.webContents.openDevTools({ mode: 'detach' });
|
win.webContents.openDevTools({ mode: 'detach' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const createTray = (window) => {
|
||||||
|
const tray = new Tray(
|
||||||
|
path.join(
|
||||||
|
__dirname,
|
||||||
|
isDev ? '../public/icon-rounded.png' : '../dist/icon-rounded.png'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const contextMenu = Menu.buildFromTemplate([
|
||||||
|
{ label: 'Show', click: () => window.show() },
|
||||||
|
{
|
||||||
|
label: 'Exit',
|
||||||
|
click: () => {
|
||||||
|
app.isQuiting = true;
|
||||||
|
app.quit();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
tray.on('click', () => window.show());
|
||||||
|
tray.setToolTip('Better ChatGPT');
|
||||||
|
tray.setContextMenu(contextMenu);
|
||||||
|
|
||||||
|
return tray;
|
||||||
|
};
|
||||||
|
|
||||||
app.whenReady().then(createWindow);
|
app.whenReady().then(createWindow);
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
},
|
},
|
||||||
"dmg": {
|
"dmg": {
|
||||||
"title": "${productName} ${version}",
|
"title": "${productName} ${version}",
|
||||||
"icon": "dist/favicon-516x516.png"
|
"icon": "dist/icon-rounded.png"
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
"target": [
|
"target": [
|
||||||
|
@ -32,11 +32,11 @@
|
||||||
"AppImage"
|
"AppImage"
|
||||||
],
|
],
|
||||||
"category": "Chat",
|
"category": "Chat",
|
||||||
"icon": "dist/favicon-516x516.png"
|
"icon": "dist/icon-rounded.png"
|
||||||
},
|
},
|
||||||
"win": {
|
"win": {
|
||||||
"target": "NSIS",
|
"target": "NSIS",
|
||||||
"icon": "dist/favicon-516x516.png"
|
"icon": "dist/icon-rounded.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
BIN
public/icon-rounded.png
Normal file
BIN
public/icon-rounded.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
Loading…
Reference in a new issue