Linux fixes

This commit is contained in:
2019-10-22 21:03:15 -05:00
parent 91c732d87d
commit 032d12aee6
2 changed files with 27 additions and 25 deletions

View File

@@ -39,9 +39,11 @@ const StateIPC = require('../src/renderer/ipc/StateIPC');
const SystemIPC = require('../src/renderer/ipc/SystemIPC');
const UpgradeIPC = require('../src/renderer/ipc/UpgradeIPC');
const platform = os.platform();
const dimensions = {
height: ((os.platform() === 'darwin') ? 346 : 326),
width: 428 + ((os.platform() === 'win32') ? 40 : (os.platform() === 'darwin') ? 190 : 200),
height: ((platform === 'darwin') ? 346 : (platform === 'win32') ? 326 : 300),
width: 428 + ((platform === 'win32') ? 40 : (platform === 'darwin') ? 190 : 200),
};
let isShutdown = false;
@@ -80,9 +82,9 @@ const createWindow = () => {
loadUiSettings();
let extra = {};
if (os.platform() === 'linux') {
if (platform === 'linux') {
extra = {
icon: path.join(__dirname, '../', 'icon.png'),
icon: path.join(__dirname, '../build/', 'logo.png'),
}
}
@@ -100,9 +102,12 @@ const createWindow = () => {
webSecurity: !process.env.ELECTRON_START_URL
}
});
mainWindow.removeMenu();
if ((os.platform() === 'darwin') && launchHidden) {
if (platform === 'linux') {
mainWindow.setMenuBarVisibility(false);
} else {
mainWindow.removeMenu();
}
if ((platform === 'darwin') && launchHidden) {
app.dock.hide();
}
@@ -132,8 +137,8 @@ const createWindow = () => {
MountsIPC.unmountAllDrives();
});
const appPath = (os.platform() === 'win32') ? path.resolve(path.join(app.getAppPath(), '..\\..\\repertory-ui.exe')) :
(os.platform() === 'darwin') ? path.resolve(path.join(path.dirname(app.getAppPath()), '../MacOS/repertory-ui')) :
const appPath = (platform === 'win32') ? path.resolve(path.join(app.getAppPath(), '..\\..\\repertory-ui.exe')) :
(platform === 'darwin') ? path.resolve(path.join(path.dirname(app.getAppPath()), '../MacOS/repertory-ui')) :
process.env.APPIMAGE;
const autoLauncher = new AutoLaunch({
@@ -177,7 +182,7 @@ const createWindow = () => {
}
]);
const image = nativeImage.createFromPath(path.join(__dirname, (os.platform() === 'darwin') ? '../build/logo_mac.png' : '../build/logo.png'));
const image = nativeImage.createFromPath(path.join(__dirname, (platform === 'darwin') ? '../build/logo_mac.png' : '../build/logo.png'));
mainWindowTray = new Tray(image);
autoLauncher
@@ -199,7 +204,7 @@ const getMainWindow = () => {
};
const loadUiSettings = () => {
const settingFile = path.join(helpers.resolvePath(Constants.DATA_LOCATIONS[os.platform()]), 'ui.json');
const settingFile = path.join(helpers.resolvePath(Constants.DATA_LOCATIONS[platform]), 'ui.json');
try {
if (fs.statSync(settingFile).isFile()) {
const settings = JSON.parse(fs.readFileSync(settingFile, 'utf8'));
@@ -228,9 +233,9 @@ const setIsInstalling = installing => {
const setTrayImage = driveInUse => {
let image;
if (driveInUse) {
image = nativeImage.createFromPath(path.join(__dirname, os.platform() === 'darwin' ? '../build/logo_both_mac.png' : '../build/logo_both.png'));
image = nativeImage.createFromPath(path.join(__dirname, 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'));
image = nativeImage.createFromPath(path.join(__dirname, platform === 'darwin' ? '../build/logo_mac.png' : '../build/logo.png'));
}
mainWindowTray.setImage(image);
};
@@ -238,8 +243,10 @@ const setTrayImage = driveInUse => {
const setWindowVisibility = show => {
if (show) {
mainWindow.show();
if (os.platform() === 'darwin') {
if (platform === 'darwin') {
app.dock.show();
} else if (platform === 'linux') {
mainWindow.setSize(dimensions.width, dimensions.height);
}
if (mainWindow.isMinimized()) {
@@ -248,7 +255,7 @@ const setWindowVisibility = show => {
mainWindow.focus();
} else {
mainWindow.hide();
if (os.platform() === 'darwin') {
if (platform === 'darwin') {
app.dock.hide();
}
}
@@ -271,9 +278,6 @@ const standardIPCReply = (event, channel, data, error) => {
}
};
app.on('before-quit', function () {
isQuiting = true;
});