Skip to content

Commit

Permalink
💄 Use primary monitor instead of current (#32)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
frikksol authored May 4, 2022
1 parent 0faa4f8 commit b68dba0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/tauri/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit b68dba0

Please sign in to comment.