From f264dad6ce39ca79202c20121876f0fe41fddf9f Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Fri, 9 Nov 2018 11:42:37 -0600 Subject: [PATCH] [Updated docs] [Launch hidden option] --- CHANGELOG.md | 1 + README.md | 3 ++- electron.js | 39 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45d2ed2..d9714da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Changelog # ## 1.0.2 ## +* Launch hidden (notification icon only) * OS X support * SiaPrime support diff --git a/README.md b/README.md index 06967d0..db8fb91 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # Repertory UI ![alt text](https://image.ibb.co/edOg5A/repertory-ui-1-0-2.png) ### GUI for [Repertory](https://bitbucket.org/blockstorage/repertory) ### -Repertory allows you to mount Hyperspace or Sia blockchain storage solutions via FUSE on Linux/OS X or via WinFSP on Windows. +Repertory allows you to mount Sia, SiaPrime and/or Hyperspace blockchain storage solutions via FUSE on Linux/OS X or via WinFSP on Windows. # Downloads # +* [Repertory UI v1.0.2 OS X]() * [Repertory UI v1.0.2 Windows 64-bit]() # Supported Platforms # * OS X diff --git a/electron.js b/electron.js index d6761cb..ab042e4 100644 --- a/electron.js +++ b/electron.js @@ -19,14 +19,18 @@ let mainWindow; let mainWindowTray; let mountedPIDs = []; let expectedUnmount = {}; +let launchHidden = false; function createWindow() { + loadUiSettings(); + // Create the browser window. const height = process.env.ELECTRON_START_URL ? 394 : 374; mainWindow = new BrowserWindow({ width: 425, height: height, resizable: false, + show: !launchHidden, title: 'Repertory UI', webPreferences: { webSecurity: !process.env.ELECTRON_START_URL @@ -72,7 +76,8 @@ function createWindow() { } else { mainWindow.hide(); } - } + }, + checked: !launchHidden, }, { label: 'Auto-start', type: 'checkbox', click(item) { @@ -86,6 +91,16 @@ function createWindow() { { type: 'separator' }, + { + label: 'Launch Hidden', type: 'checkbox', click(item) { + launchHidden = !!item.checked; + saveUiSettings(); + }, + checked: launchHidden, + }, + { + type: 'separator' + }, { label: 'Exit', click(item) { app.quit(); @@ -93,7 +108,6 @@ function createWindow() { } ]); - mainContextWindow.items[0].checked = true; autoLauncher .isEnabled() .then((enabled) => { @@ -145,6 +159,27 @@ if (!instanceLock) { }); } +const loadUiSettings = () => { + const settingFile = path.join(helpers.resolvePath(Constants.DATA_LOCATIONS[os.platform()]), 'ui.json'); + try { + if (fs.statSync(settingFile).isFile()) { + const settings = JSON.parse(fs.readFileSync(settingFile, 'utf8')); + launchHidden = settings.launch_hidden; + } + } catch (e) { + } +}; + +const saveUiSettings = () => { + const settingFile = path.join(helpers.resolvePath(Constants.DATA_LOCATIONS[os.platform()]), 'ui.json'); + try { + fs.writeFileSync(settingFile, JSON.stringify({ + launch_hidden: launchHidden, + }), 'utf-8'); + } catch (e) { + } +}; + const standardIPCReply = (event, channel, data, error) => { event.sender.send(channel, { data: {