Closed groundbirdaircat closed 7 months ago
Hi, @heyman, I was looking into this enhancement request and this can be achieved by adding this to config while creating new BrowserWindow
let windowConfig = {
width: CONFIG.get("windowConfig.width", 900) as number,
height: CONFIG.get("windowConfig.height", 680) as number,
x: CONFIG.get("windowConfig.x") as number,
y: CONFIG.get("windowConfig.y") as number,
isMaximized: CONFIG.get("windowConfig.isMaximized", false) as boolean,
isFullScreen: CONFIG.get("windowConfig.isFullScreen", false) as boolean,
}
but the problem here is a default value in case x and y are not found in config, we cant just pass any arbitrary value as we would like to center the window in that case, I can technically do the following to avoid passing the x and y value in case they are not present and window will automatically be centered,
let window_offset = {};
if(CONFIG.get("windowConfig.x") && CONFIG.get("windowConfig.y")) window_offset = {
x: CONFIG.get("windowConfig.x") as number,
y: CONFIG.get("windowConfig.y") as number,
}
let windowConfig = {
width: CONFIG.get("windowConfig.width", 900) as number,
height: CONFIG.get("windowConfig.height", 680) as number,
isMaximized: CONFIG.get("windowConfig.isMaximized", false) as boolean,
isFullScreen: CONFIG.get("windowConfig.isFullScreen", false) as boolean,
...window_offset
}
this will get the job done but I am not sure if it's the right way of doing this. Could you share your opinions on this?
Fixed by #171
Currently the application always opens in the center of the primary monitor.
This request is for the window to open up wherever it was when it was last closed.