From b68dba02d665c51d209ccb5a84da083f7fce5628 Mon Sep 17 00:00:00 2001 From: Frikk Herding Date: Wed, 4 May 2022 23:50:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Use=20primary=20monitor=20instea?= =?UTF-8?q?d=20of=20current=20(#32)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IMO current_monitor is a bit misleading as it uses the current monitor the app is in, not the current monitor the user interacts with. This is not optimal in a multi-monitor setup, as you often end up with spyglass on the monitor that is not your primary. primary_monitor on the other hand uses, you guessed it, the primary monitor, which I see as more logical. The optimal solution would be to get the monitor that the user is currently interacting with, but this is not trivial. --- crates/tauri/src/window.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/tauri/src/window.rs b/crates/tauri/src/window.rs index 64a9d1ba8..1c0c12167 100644 --- a/crates/tauri/src/window.rs +++ b/crates/tauri/src/window.rs @@ -3,7 +3,7 @@ use tauri::{async_runtime::spawn, LogicalSize, Size, Window}; use crate::{cmd, constants}; pub fn center_window(window: &Window) { - if let Some(monitor) = window.current_monitor().unwrap() { + if let Some(monitor) = window.primary_monitor().unwrap() { let size = monitor.size(); let scale = monitor.scale_factor();