OS X changes
This commit is contained in:
38
electron.js
38
electron.js
@@ -37,9 +37,9 @@ function createWindow() {
|
|||||||
loadUiSettings();
|
loadUiSettings();
|
||||||
|
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
const height = (process.env.ELECTRON_START_URL ? 364 : 344) - ((os.platform() === 'win32') || (os.platform() === 'darwin') ? 0 : 20);
|
const height = (process.env.ELECTRON_START_URL ? 364 : 344) - ((os.platform() === 'win32') ? 0 : 20);
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
width: 428 + (os.platform() === 'win32' ? 0 : 160),
|
width: 428 + ((os.platform() === 'win32') ? 0 : (os.platform() === 'darwin') ? 150 : 160),
|
||||||
height: height,
|
height: height,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
show: !launchHidden,
|
show: !launchHidden,
|
||||||
@@ -83,7 +83,7 @@ function createWindow() {
|
|||||||
path: appPath,
|
path: appPath,
|
||||||
});
|
});
|
||||||
|
|
||||||
const image = nativeImage.createFromPath(path.join(__dirname, (os.platform() === 'darwin') ? '/build/icon.icns' : '/build/logo.png'));
|
const image = nativeImage.createFromPath(path.join(__dirname, (os.platform() === 'darwin') ? '/build/logo_mac.png' : '/build/logo.png'));
|
||||||
trayContextMenu = Menu.buildFromTemplate([
|
trayContextMenu = Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
label: 'Visible', type: 'checkbox', click(item) {
|
label: 'Visible', type: 'checkbox', click(item) {
|
||||||
@@ -373,25 +373,23 @@ ipcMain.on(Constants.IPC_Detect_Mounts, (event, data) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const setImage = (locations) => {
|
const setImage = (locations) => {
|
||||||
if (os.platform() === 'win32' || os.platform() === 'linux') {
|
let driveInUse;
|
||||||
let driveInUse;
|
if (Object.keys(locations).length > 0) {
|
||||||
if (Object.keys(locations).length > 0) {
|
for (const provider of Constants.PROVIDER_LIST) {
|
||||||
for (const provider of Constants.PROVIDER_LIST) {
|
driveInUse = locations[provider].length > 0;
|
||||||
driveInUse = locations[provider].length > 0;
|
if (driveInUse)
|
||||||
if (driveInUse)
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let image;
|
|
||||||
if (driveInUse) {
|
|
||||||
image = nativeImage.createFromPath(path.join(__dirname, '/build/logo_both.png'));
|
|
||||||
} else {
|
|
||||||
image = nativeImage.createFromPath(path.join(__dirname, '/build/logo.png'));
|
|
||||||
}
|
|
||||||
|
|
||||||
mainWindowTray.setImage(image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let image;
|
||||||
|
if (driveInUse) {
|
||||||
|
image = nativeImage.createFromPath(path.join(__dirname, os.platform() === 'darwin' ? '/build/logo_both_mac.png' : '/build/logo_both.png'));
|
||||||
|
} else {
|
||||||
|
image = nativeImage.createFromPath(path.join(__dirname, os.platform() === 'darwin' ? '/build/logo_mac.png' : '/build/logo.png'));
|
||||||
|
}
|
||||||
|
|
||||||
|
mainWindowTray.setImage(image);
|
||||||
};
|
};
|
||||||
|
|
||||||
const dataDirectory = helpers.resolvePath(data.Directory);
|
const dataDirectory = helpers.resolvePath(data.Directory);
|
||||||
|
|||||||
BIN
public/logo_both_mac.png
Normal file
BIN
public/logo_both_mac.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 269 B |
BIN
public/logo_mac.png
Normal file
BIN
public/logo_mac.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 265 B |
@@ -11,10 +11,11 @@ if (!process.versions.hasOwnProperty('electron')) {
|
|||||||
const ipcRenderer = ((window && window.require) ? window.require('electron').ipcRenderer : null);
|
const ipcRenderer = ((window && window.require) ? window.require('electron').ipcRenderer : null);
|
||||||
if (ipcRenderer) {
|
if (ipcRenderer) {
|
||||||
ipcRenderer.on(Constants.IPC_Get_Platform_Reply, (event, arg) => {
|
ipcRenderer.on(Constants.IPC_Get_Platform_Reply, (event, arg) => {
|
||||||
if (arg.data !== 'win32') {
|
if (arg.data === 'linux') {
|
||||||
let root = document.documentElement;
|
let root = document.documentElement;
|
||||||
root.style.setProperty('--default_font_size', '4.8vmin');
|
root.style.setProperty('--default_font_size', '4.8vmin');
|
||||||
}
|
}
|
||||||
|
|
||||||
ReactDOM.render(<App platform={arg.data} version={packageJson.version}/>, document.getElementById('root'));
|
ReactDOM.render(<App platform={arg.data} version={packageJson.version}/>, document.getElementById('root'));
|
||||||
registerServiceWorker();
|
registerServiceWorker();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user