Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Commit

Permalink
fix: preserve state of the windows
Browse files Browse the repository at this point in the history
  • Loading branch information
oae committed Apr 13, 2019
1 parent 878c02c commit 4715dc1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions appWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ var AppWindow = class AppWindow {
return;
}

if (this.hidden) {
if (this.hidden === true) {
this.show();
} else {
this.hide();
Expand Down Expand Up @@ -155,7 +155,7 @@ var AppWindow = class AppWindow {
attach() {
this.removeCloseButton();
this.addTray();
if (this.hidden) {
if (this.hidden === true) {
this.hide();
} else {
this.show();
Expand Down
8 changes: 5 additions & 3 deletions windowListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ var WindowListener = class WindowListener {
) {
const appWindow = new AppWindow(metaWindow);
const isHidden = currentState.some(
({ pid, idInDec, hidden }) =>
metaWindow.get_pid().toString() === pid && hidden === 'true',
({ pid, idInDec, hidden }) => metaWindow.get_pid() === pid && hidden === true,
);
if (isHidden) {
appWindow.hidden = true;
Expand Down Expand Up @@ -127,7 +126,10 @@ var WindowListener = class WindowListener {
_cleanupWindows() {
let shouldUpdateState = false;
this.appWindows = this.appWindows.filter(appWin => {
if (!windowExists(appWin.pid, appWin.idInDec) || !this.apps.some(app => app.name === appWin.name && app.state === 'enabled')) {
if (
!windowExists(appWin.pid, appWin.idInDec) ||
!this.apps.some(app => app.name === appWin.name && app.state === 'enabled')
) {
debug(`removing window: ${appWin}`);
shouldUpdateState = true;
appWin.destroy();
Expand Down

0 comments on commit 4715dc1

Please sign in to comment.