mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Merge pull request #226 from VishwasShashidhar/electron-201
Electron 201: auto launch fixes
This commit is contained in:
@@ -4,24 +4,24 @@
|
|||||||
tempFilePath='/tmp/sym_settings.txt'
|
tempFilePath='/tmp/sym_settings.txt'
|
||||||
installPath="$2"
|
installPath="$2"
|
||||||
configPath="/Symphony.app/Contents/config/Symphony.config"
|
configPath="/Symphony.app/Contents/config/Symphony.config"
|
||||||
newPath=$installPath$configPath
|
newPath=${installPath}${configPath}
|
||||||
|
|
||||||
## Get Symphony Settings from the temp file ##
|
## Get Symphony Settings from the temp file ##
|
||||||
pod_url=$(sed -n '1p' $tempFilePath);
|
pod_url=$(sed -n '1p' ${tempFilePath});
|
||||||
minimize_on_close=$(sed -n '2p' '/tmp/sym_settings.txt');
|
minimize_on_close=$(sed -n '2p' '/tmp/sym_settings.txt');
|
||||||
launch_on_startup=$(sed -n '3p' '/tmp/sym_settings.txt');
|
launch_on_startup=$(sed -n '3p' '/tmp/sym_settings.txt');
|
||||||
always_on_top=$(sed -n '4p' '/tmp/sym_settings.txt');
|
always_on_top=$(sed -n '4p' '/tmp/sym_settings.txt');
|
||||||
|
|
||||||
## Replace the default settings with the user selected settings ##
|
## Replace the default settings with the user selected settings ##
|
||||||
sed -i "" -E "s#\"url\" ?: ?\".*\"#\"url\"\: \"$pod_url\"#g" $newPath
|
sed -i "" -E "s#\"url\" ?: ?\".*\"#\"url\"\: \"$pod_url\"#g" ${newPath}
|
||||||
sed -i "" -E "s#\"minimizeOnClose\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"minimizeOnClose\":\ $minimize_on_close#g" $newPath
|
sed -i "" -E "s#\"minimizeOnClose\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"minimizeOnClose\":\ $minimize_on_close#g" ${newPath}
|
||||||
sed -i "" -E "s#\"alwaysOnTop\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"alwaysOnTop\":\ $always_on_top#g" $newPath
|
sed -i "" -E "s#\"alwaysOnTop\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"alwaysOnTop\":\ $always_on_top#g" ${newPath}
|
||||||
sed -i "" -E "s#\"launchOnStartup\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"launchOnStartup\":\ $launch_on_startup#g" $newPath
|
sed -i "" -E "s#\"launchOnStartup\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"launchOnStartup\":\ $launch_on_startup#g" ${newPath}
|
||||||
|
|
||||||
## Remove the temp settings file created ##
|
## Remove the temp settings file created ##
|
||||||
rm -f $tempFilePath
|
rm -f ${tempFilePath}
|
||||||
|
|
||||||
## For launching symphony with sandbox enabled, create a shell script that is used as the launch point for the app
|
## For launching symphony with sandbox enabled, create a shell script that is used as the launch point for the app
|
||||||
EXEC_PATH=$installPath/Symphony.app/Contents/MacOS
|
EXEC_PATH=${installPath}/Symphony.app/Contents/MacOS
|
||||||
exec $EXEC_PATH/Symphony --install $newPath $launch_on_startup
|
exec ${EXEC_PATH}/Symphony --install ${newPath} ${launch_on_startup}
|
||||||
chmod 755 $EXEC_PATH/Symphony
|
chmod 755 ${EXEC_PATH}/Symphony
|
||||||
|
|||||||
24
js/main.js
24
js/main.js
@@ -180,9 +180,8 @@ function setupThenOpenMainWindow() {
|
|||||||
let launchOnStartup = process.argv[3];
|
let launchOnStartup = process.argv[3];
|
||||||
// We wire this in via the post install script
|
// We wire this in via the post install script
|
||||||
// to get the config file path where the app is installed
|
// to get the config file path where the app is installed
|
||||||
let appGlobalConfigPath = process.argv[2];
|
|
||||||
setStartup(launchOnStartup)
|
setStartup(launchOnStartup)
|
||||||
.then(() => updateUserConfigMac(appGlobalConfigPath))
|
.then(updateUserConfigMac)
|
||||||
.then(app.quit)
|
.then(app.quit)
|
||||||
.catch(app.quit);
|
.catch(app.quit);
|
||||||
return;
|
return;
|
||||||
@@ -201,18 +200,15 @@ function setupThenOpenMainWindow() {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
function setStartup(lStartup) {
|
function setStartup(lStartup) {
|
||||||
return symphonyAutoLauncher.isEnabled()
|
return new Promise((resolve) => {
|
||||||
.then(function(isEnabled) {
|
let launchOnStartup = (lStartup === 'true');
|
||||||
if (!isEnabled && lStartup) {
|
if (launchOnStartup) {
|
||||||
return symphonyAutoLauncher.enable();
|
symphonyAutoLauncher.enable();
|
||||||
}
|
return resolve();
|
||||||
|
}
|
||||||
if (isEnabled && !lStartup) {
|
symphonyAutoLauncher.disable();
|
||||||
return symphonyAutoLauncher.disable();
|
return resolve();
|
||||||
}
|
});
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user