From 272955b9d632ea71af152e94b6cb650596082370 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 11 Sep 2017 09:47:04 -0700 Subject: [PATCH] focus() visible window on show-window instead of show() (#1455) When clicking on a notification in Windows when a window had been stuck to one side of the screen using Snap, the window would be repositioned. Fixes #1453 FREEBIE --- main.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 4174a8927..3275f2b3e 100644 --- a/main.js +++ b/main.js @@ -146,7 +146,15 @@ function createWindow () { }); ipc.on('show-window', function() { - mainWindow.show(); + // Using focus() instead of show() seems to be important on Windows when our window + // has been docked using Aero Snap/Snap Assist. A full .show() call here will cause + // the window to reposition: + // https://github.com/WhisperSystems/Signal-Desktop/issues/1429 + if (mainWindow.isVisible()) { + mainWindow.focus(); + } else { + mainWindow.show(); + } }); }