diff --git a/source/index.ts b/source/index.ts index b82b2a6d7..e2c3704f2 100644 --- a/source/index.ts +++ b/source/index.ts @@ -92,6 +92,14 @@ app.on('second-instance', () => { } }); +// Preserves the window position when a display is removed and Caprine is moved to a different screen. +app.on('ready', () => { + electronScreen.on('display-removed', () => { + const [x, y] = mainWindow.getPosition(); + mainWindow.setPosition(x, y); + }); +}); + function getMessageCount(conversations: Conversation[]): number { return conversations.filter(({unread}) => unread).length; }