Skip to content

Commit

Permalink
Merge pull request #941 from RocketChat/fix/window-closing-behavior
Browse files Browse the repository at this point in the history
[FIX] Window closing behavior for Linux environments without a system tray
  • Loading branch information
tassoevan authored Oct 22, 2018
2 parents 4ed6120 + ddbaaea commit 0bf4128
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/background/mainWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import windowStateKeeper from './windowState';
import env from '../env';

let mainWindow = null;
let hideOnClose = true;
let hideOnClose = false;

const mainWindowOptions = {
width: 1000,
Expand Down Expand Up @@ -49,11 +49,11 @@ const attachWindowStateHandling = (mainWindow) => {
event.preventDefault();
if (mainWindow.isFullScreen()) {
mainWindow.once('leave-full-screen', () => {
(process.platform === 'darwin' || hideOnClose) ? mainWindow.hide() : mainWindow.destroy();
(process.platform === 'darwin' || hideOnClose) ? mainWindow.hide() : mainWindow.minimize();
});
mainWindow.setFullScreen(false);
} else {
(process.platform === 'darwin' || hideOnClose) ? mainWindow.hide() : mainWindow.destroy();
(process.platform === 'darwin' || hideOnClose) ? mainWindow.hide() : mainWindow.minimize();
}
mainWindowState.saveState(mainWindow);
});
Expand Down
6 changes: 4 additions & 2 deletions src/scripts/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export default () => {
const mainWindow = getCurrentWindow();

menus.setState({
showTrayIcon: localStorage.getItem('hideTray') !== 'true',
showTrayIcon: localStorage.getItem('hideTray') ?
localStorage.getItem('hideTray') !== 'true' : (process.platform !== 'linux'),
showUserStatusInTray: (localStorage.getItem('showUserStatusInTray') || 'true') === 'true',
showFullScreen: mainWindow.isFullScreen(),
showWindowOnUnreadChanged: localStorage.getItem('showWindowOnUnreadChanged') === 'true',
Expand All @@ -79,7 +80,8 @@ export default () => {
});

tray.setState({
showIcon: localStorage.getItem('hideTray') !== 'true',
showIcon: localStorage.getItem('hideTray') ?
localStorage.getItem('hideTray') !== 'true' : (process.platform !== 'linux'),
showUserStatus: (localStorage.getItem('showUserStatusInTray') || 'true') === 'true',
});
};
Expand Down

0 comments on commit 0bf4128

Please sign in to comment.