GUI: Open settings window centered above mainwindow (#4880)

On multiscreen setup or big monitor it is confusing if
settings window opens far away. With that it will be
centered.

Co-authored-by: Manuel Stein <manuel.stein@gmx.net>
This commit is contained in:
manuel-91 2021-02-05 00:30:37 +01:00 committed by GitHub
parent 8d3d51314e
commit 7095e070eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

11
main.js
View file

@ -693,9 +693,16 @@ function showSettingsWindow() {
addDarkOverlay();
const size = mainWindow.getSize();
// center settings window over main window
const settingwidth = Math.min(500, size[0]);
const settingheight = Math.max(size[1] - 100, MIN_HEIGHT);
const mainPos = mainWindow.getPosition();
const mainSize = mainWindow.getSize();
const options = {
width: Math.min(500, size[0]),
height: Math.max(size[1] - 100, MIN_HEIGHT),
x: Math.round(mainPos[0] + mainSize[0] / 2 - settingwidth / 2),
y: Math.round(mainPos[1] + mainSize[1] / 2 - settingheight / 2),
width: settingwidth,
height: settingheight,
frame: false,
resizable: false,
title: locale.messages.signalDesktopPreferences.message,