OS X changes
This commit is contained in:
144
electron.js
144
electron.js
@@ -74,86 +74,84 @@ function createWindow() {
|
|||||||
mountedData = {};
|
mountedData = {};
|
||||||
});
|
});
|
||||||
|
|
||||||
if ((os.platform() === 'win32') || (os.platform() === 'linux')) {
|
const appPath = (os.platform() === 'win32') ? path.resolve(path.join(app.getAppPath(), '..\\..\\repertory-ui.exe')) :
|
||||||
const appPath = (os.platform() === 'win32') ?
|
(os.platform() === 'darwin') ? app.getAppPath() :
|
||||||
path.resolve(path.join(app.getAppPath(), '..\\..\\repertory-ui.exe')) :
|
process.env.APPIMAGE;
|
||||||
process.env.APPIMAGE;
|
|
||||||
|
|
||||||
const autoLauncher = new AutoLaunch({
|
const autoLauncher = new AutoLaunch({
|
||||||
name: 'Repertory UI',
|
name: 'Repertory UI',
|
||||||
path: appPath,
|
path: appPath,
|
||||||
});
|
});
|
||||||
|
|
||||||
const image = nativeImage.createFromPath(path.join(__dirname, '/build/logo.png'));
|
const image = nativeImage.createFromPath(path.join(__dirname, (os.platform() === 'darwin') ? '/build/icon.icns' : '/build/logo.png'));
|
||||||
trayContextMenu = Menu.buildFromTemplate([
|
trayContextMenu = Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
label: 'Visible', type: 'checkbox', click(item) {
|
label: 'Visible', type: 'checkbox', click(item) {
|
||||||
if (item.checked) {
|
if (item.checked) {
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
if (mainWindow.isMinimized()) {
|
if (mainWindow.isMinimized()) {
|
||||||
mainWindow.restore();
|
mainWindow.restore();
|
||||||
}
|
|
||||||
mainWindow.focus()
|
|
||||||
} else {
|
|
||||||
mainWindow.hide();
|
|
||||||
}
|
}
|
||||||
},
|
mainWindow.focus()
|
||||||
checked: !launchHidden,
|
} else {
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Auto-start', type: 'checkbox', click(item) {
|
|
||||||
if (item.checked) {
|
|
||||||
autoLauncher.enable();
|
|
||||||
} else {
|
|
||||||
autoLauncher.disable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'separator'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Launch Hidden', type: 'checkbox', click(item) {
|
|
||||||
launchHidden = !!item.checked;
|
|
||||||
saveUiSettings();
|
|
||||||
},
|
|
||||||
checked: launchHidden,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'separator'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Exit and Unmount', click(item) {
|
|
||||||
closeApplication();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
mainWindow.on('close', function (event) {
|
|
||||||
if (!isQuiting) {
|
|
||||||
event.preventDefault();
|
|
||||||
if (mainWindow.isVisible()) {
|
|
||||||
mainWindow.hide();
|
mainWindow.hide();
|
||||||
trayContextMenu.items[0].checked = false;
|
|
||||||
mainWindowTray.setContextMenu(trayContextMenu);
|
|
||||||
}
|
}
|
||||||
event.returnValue = false;
|
},
|
||||||
|
checked: !launchHidden,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Auto-start', type: 'checkbox', click(item) {
|
||||||
|
if (item.checked) {
|
||||||
|
autoLauncher.enable();
|
||||||
|
} else {
|
||||||
|
autoLauncher.disable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
{
|
||||||
autoLauncher
|
type: 'separator'
|
||||||
.isEnabled()
|
},
|
||||||
.then((enabled) => {
|
{
|
||||||
trayContextMenu.items[1].checked = enabled;
|
label: 'Launch Hidden', type: 'checkbox', click(item) {
|
||||||
|
launchHidden = !!item.checked;
|
||||||
mainWindowTray = new Tray(image);
|
saveUiSettings();
|
||||||
mainWindowTray.setToolTip('Repertory UI');
|
},
|
||||||
mainWindowTray.setContextMenu(trayContextMenu)
|
checked: launchHidden,
|
||||||
})
|
},
|
||||||
.catch(() => {
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Exit and Unmount', click() {
|
||||||
closeApplication();
|
closeApplication();
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
mainWindow.on('close', function (event) {
|
||||||
|
if (!isQuiting) {
|
||||||
|
event.preventDefault();
|
||||||
|
if (mainWindow.isVisible()) {
|
||||||
|
mainWindow.hide();
|
||||||
|
trayContextMenu.items[0].checked = false;
|
||||||
|
mainWindowTray.setContextMenu(trayContextMenu);
|
||||||
|
}
|
||||||
|
event.returnValue = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
autoLauncher
|
||||||
|
.isEnabled()
|
||||||
|
.then((enabled) => {
|
||||||
|
trayContextMenu.items[1].checked = enabled;
|
||||||
|
|
||||||
|
mainWindowTray = new Tray(image);
|
||||||
|
mainWindowTray.setToolTip('Repertory UI');
|
||||||
|
mainWindowTray.setContextMenu(trayContextMenu)
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
closeApplication();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const instanceLock = app.requestSingleInstanceLock();
|
const instanceLock = app.requestSingleInstanceLock();
|
||||||
|
|||||||
@@ -129,10 +129,10 @@
|
|||||||
"./helpers.js"
|
"./helpers.js"
|
||||||
],
|
],
|
||||||
"linux": {
|
"linux": {
|
||||||
"icon": "./build/icon.icns"
|
"icon": "./build/logo.png"
|
||||||
},
|
},
|
||||||
"mac": {
|
"mac": {
|
||||||
"icon": "./build/icon.icns"
|
"icon": "./build/icon_color.icns"
|
||||||
},
|
},
|
||||||
"win": {
|
"win": {
|
||||||
"icon": "./build/icon.ico"
|
"icon": "./build/icon.ico"
|
||||||
|
|||||||
BIN
public/icon_color.icns
Normal file
BIN
public/icon_color.icns
Normal file
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.4 KiB |
Reference in New Issue
Block a user