ADD: App icon
doesn't show up :(
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,5 +1,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
packagerConfig: {},
|
packagerConfig: {
|
||||||
|
icon: 'src/assets/favicon',
|
||||||
|
},
|
||||||
rebuildConfig: {},
|
rebuildConfig: {},
|
||||||
makers: [
|
makers: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="icon" href="/src/assets/favico.png">
|
<link rel="icon" href="/src/assets/favicon.png">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Zero-One : Haptic Configuration Tool</title>
|
<title>ZERO/ONE : Haptic Configuration Tool</title>
|
||||||
</head>
|
</head>
|
||||||
<body class="dark bg-background">
|
<body class="dark bg-background">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
BIN
src/assets/favicon.ico
Normal file
BIN
src/assets/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 200 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
67
src/main.js
67
src/main.js
@@ -1,14 +1,14 @@
|
|||||||
import { app, BrowserWindow } from 'electron';
|
import { app, BrowserWindow } from 'electron'
|
||||||
import path from 'path';
|
import path from 'path'
|
||||||
import ess from 'electron-squirrel-startup';
|
import ess from 'electron-squirrel-startup'
|
||||||
import { ipcMain } from 'electron';
|
import { ipcMain } from 'electron'
|
||||||
import nanodevices from './backend/nanodevices.js';
|
import nanodevices from './backend/nanodevices.js'
|
||||||
import nano from './backend/nano.js';
|
import nano from './backend/nano.js'
|
||||||
|
|
||||||
|
|
||||||
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
|
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
|
||||||
if (ess) {
|
if (ess) {
|
||||||
app.quit();
|
app.quit()
|
||||||
}
|
}
|
||||||
|
|
||||||
const createWindow = () => {
|
const createWindow = () => {
|
||||||
@@ -16,64 +16,65 @@ const createWindow = () => {
|
|||||||
const mainWindow = new BrowserWindow({
|
const mainWindow = new BrowserWindow({
|
||||||
width: 1100,
|
width: 1100,
|
||||||
height: 912,
|
height: 912,
|
||||||
|
icon: path.join(__dirname, '../renderer/main_window/assets/favicon.png'),
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, 'preload.js'),
|
preload: path.join(__dirname, 'preload.js'),
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
|
|
||||||
// and load the index.html of the app.
|
// and load the index.html of the app.
|
||||||
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
|
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
|
||||||
mainWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL);
|
mainWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL)
|
||||||
} else {
|
} else {
|
||||||
mainWindow.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`));
|
mainWindow.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the DevTools.
|
// Open the DevTools.
|
||||||
mainWindow.webContents.openDevTools();
|
mainWindow.webContents.openDevTools()
|
||||||
|
|
||||||
return mainWindow;
|
return mainWindow
|
||||||
};
|
}
|
||||||
|
|
||||||
// This method will be called when Electron has finished
|
// This method will be called when Electron has finished
|
||||||
// initialization and is ready to create browser windows.
|
// initialization and is ready to create browser windows.
|
||||||
// Some APIs can only be used after this event occurs.
|
// Some APIs can only be used after this event occurs.
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
ipcMain.handle('nanodevices:list', nanodevices.list);
|
ipcMain.handle('nanodevices:list', nanodevices.list)
|
||||||
ipcMain.handle('nanodevices:connect', nanodevices.connect);
|
ipcMain.handle('nanodevices:connect', nanodevices.connect)
|
||||||
ipcMain.handle('nanodevices:disconnect', nanodevices.disconnect);
|
ipcMain.handle('nanodevices:disconnect', nanodevices.disconnect)
|
||||||
ipcMain.handle('nano:get', nano.get);
|
ipcMain.handle('nano:get', nano.get)
|
||||||
ipcMain.handle('nano:set', nano.set);
|
ipcMain.handle('nano:set', nano.set)
|
||||||
const mainWindow = createWindow();
|
const mainWindow = createWindow()
|
||||||
nanodevices.onAttach((device) => {
|
nanodevices.onAttach((device) => {
|
||||||
console.log("Attached device", device);
|
console.log('Attached device', device)
|
||||||
mainWindow.webContents.send('nanodevice-attached', device);
|
mainWindow.webContents.send('nanodevice-attached', device)
|
||||||
});
|
})
|
||||||
nanodevices.onDetach((device) => {
|
nanodevices.onDetach((device) => {
|
||||||
console.log("Detached device", device);
|
console.log('Detached device', device)
|
||||||
mainWindow.webContents.send('nanodevice-detached', device);
|
mainWindow.webContents.send('nanodevice-detached', device)
|
||||||
});
|
})
|
||||||
nano.onValueReceived((value) => {
|
nano.onValueReceived((value) => {
|
||||||
console.log("Value received", value);
|
console.log('Value received', value)
|
||||||
mainWindow.webContents.send('nano-onvalue', value);
|
mainWindow.webContents.send('nano-onvalue', value)
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
// Quit when all windows are closed, except on macOS. There, it's common
|
// Quit when all windows are closed, except on macOS. There, it's common
|
||||||
// for applications and their menu bar to stay active until the user quits
|
// for applications and their menu bar to stay active until the user quits
|
||||||
// explicitly with Cmd + Q.
|
// explicitly with Cmd + Q.
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
if (process.platform !== 'darwin') {
|
if (process.platform !== 'darwin') {
|
||||||
app.quit();
|
app.quit()
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
app.on('activate', () => {
|
app.on('activate', () => {
|
||||||
// On OS X it's common to re-create a window in the app when the
|
// On OS X it's common to re-create a window in the app when the
|
||||||
// dock icon is clicked and there are no other windows open.
|
// dock icon is clicked and there are no other windows open.
|
||||||
if (BrowserWindow.getAllWindows().length === 0) {
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||||||
createWindow();
|
createWindow()
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
// In this file you can include the rest of your app's specific main process
|
// In this file you can include the rest of your app's specific main process
|
||||||
// code. You can also put them in separate files and import them here.
|
// code. You can also put them in separate files and import them here.
|
||||||
|
|||||||
Reference in New Issue
Block a user