Skip to content

Commit

Permalink
Save last URL to show it on the next start-up
Browse files Browse the repository at this point in the history
  • Loading branch information
1000ch committed Dec 1, 2016
1 parent a9e1ff4 commit 7ff43ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config.js
Expand Up @@ -6,6 +6,7 @@ module.exports = new Config({
lastWindowState: {
width: 840,
height: 840
}
},
lastURL: 'https://trello.com/login'
}
});
7 changes: 6 additions & 1 deletion index.js
Expand Up @@ -31,6 +31,7 @@ if (isAlreadyRunning) {

function createMainWindow() {
const lastWindowState = config.get('lastWindowState');
const lastURL = config.get('lastURL');
const maxWindowInteger = 2147483647; // used to set max window width/height when toggling fullscreen

const win = new electron.BrowserWindow({
Expand All @@ -57,7 +58,7 @@ function createMainWindow() {
win.setSheetOffset(40);
}

win.loadURL('https://trello.com/login');
win.loadURL(lastURL);

win.on('close', e => {
if (!isQuitting) {
Expand All @@ -79,6 +80,10 @@ function createMainWindow() {
win.setMaximumSize(maxWindowInteger, maxWindowInteger);
});

win.webContents.on('did-navigate', (e, url) => {
config.set('lastURL', url);
});

return win;
}

Expand Down

0 comments on commit 7ff43ae

Please sign in to comment.