de-async-ifying stuff = tray fixed!

This commit is contained in:
dragonwocky 2020-07-18 23:50:56 +10:00
parent 48fa62d75d
commit 0621a5710c
2 changed files with 75 additions and 71 deletions

View File

@ -23,7 +23,7 @@ module.exports = {
'https://camo.githubusercontent.com/5c5bca9e987d986b8cc7e51066f90c6f8a84af08/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3733313634373938343332333931393933332f3733313732373235393239353032333132342f494d475f323137302e6a7067',
options: [],
hacks: {
// 'main/main.js': require('./tray.js')(defaults),
'main/main.js': require('./tray.js')(defaults),
'renderer/preload.js': function (store) {
const data = store({ name: 'dragonwocky' });
console.log(data.name);

View File

@ -6,18 +6,21 @@
*/
let tray;
const electron = require('electron'),
module.exports = (defaults) =>
function (store) {
const electron = require('electron'),
path = require('path'),
is_mac = process.platform === 'darwin',
is_win = process.platform === 'win32',
settings = {};
settings = store(defaults);
electron.app.on('ready', () => {
electron.app.on('ready', () => {
tray = new electron.Tray(
is_win
? path.resolve(__dirname, 'windows.ico')
? path.normalize(`${__dirname}/windows.ico`)
: new electron.nativeImage.createFromPath(
path.resolve(__dirname, 'mac+linux.png')
path.normalize(`${__dirname}/mac+linux.png`)
).resize({
width: 16,
height: 16,
@ -78,4 +81,5 @@ electron.app.on('ready', () => {
hideWindows();
else showWindows();
});
});
});
};