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

@@ -30,7 +30,7 @@
"devDependencies": { "devDependencies": {
"cross-env": "^6.0.3", "cross-env": "^6.0.3",
"electron": "^6.1.0", "electron": "^6.1.0",
"electron-builder": "^21.2.0", "electron-builder": "^20.44.4",
"extract-text-webpack-plugin": "^3.0.2", "extract-text-webpack-plugin": "^3.0.2",
"typescript": "^3.6.4", "typescript": "^3.6.4",
"webpack-browser-plugin": "^1.0.20" "webpack-browser-plugin": "^1.0.20"
@@ -71,19 +71,17 @@
"node_modules/**/*", "node_modules/**/*",
"src/helpers.js", "src/helpers.js",
"src/renderer/**/*", "src/renderer/**/*",
"public/detect_linux.sh", "public/detect_linux.sh"
"public/install_linux.sh"
], ],
"linux": { "linux": {
"category": "Utility", "category": "Utility",
"target": "AppImage", "target": "AppImage"
"icon": "./build/icon.icns"
}, },
"mac": { "mac": {
"category": "public.app-category.utilities", "category": "public.app-category.utilities",
"icon": "./build/icon.icns",
"target": "dmg", "target": "dmg",
"darkModeSupport": true "darkModeSupport": true,
"icon": "./build/icon.icns"
}, },
"win": { "win": {
"icon": "./build/icon.ico", "icon": "./build/icon.ico",

View File

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