Skip to content

Commit

Permalink
feat: Store fullscreen state (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arubinu committed Mar 30, 2021
1 parent abdd1f2 commit 9687a0a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/main/window/storeBounds.js
Expand Up @@ -12,8 +12,18 @@ module.exports = function storeBounds({ win, name, delay = 500 } = {}) {

let timeout = null;

const loadBounds = () => win.setBounds(store.get("bounds"));
const updateBounds = () => store.set("bounds", win.getBounds());
const loadBounds = () => {
win.setBounds(store.get("bounds"));
if (store.get("fullscreen")) win.maximize();
};

const updateBounds = () => {
const maximized = win.isMaximized();

store.set("fullscreen", maximized);
if ( !maximized )
store.set("bounds", win.getBounds());
};

const updateBoundsDelay = () => {
timeout && clearTimeout(timeout);
Expand Down

0 comments on commit 9687a0a

Please sign in to comment.