[bug] When my mouse is focused on another monitor , we use primary_monitor , my primary_monitor can't show web-view window
li-yu-tfs opened this issue · 2 comments
li-yu-tfs commented
Describe the bug
When my mouse is focused on another monitor , we use primary_monitor , my primary_monitor can't show web-view window, but when i focused on primary_monitor , we use primary_monitor, will show web-view window.
this is my code, pls check.
by the way , when my mouse is another monitor or primary_monitor , the information printed is all my primary_monitor.
if let Some(primary_monitor) = app_handle.primary_monitor().unwrap() {
let screen_size = primary_monitor.size();
println!("screen_size: {:?}", screen_size);
println!("primary_monitor: {:?}", primary_monitor);
// screen_size: PhysicalSize { width: 3360, height: 2100 }
// primary_monitor: Monitor { name: Some("Monitor #41032"), size: PhysicalSize { width: 3360, height: 2100 }, position: PhysicalPosition { x: 0, y: 0 }, scale_factor: 2.0 }
let window_size = voice_bubble.inner_size().unwrap();
let margin = 140.0;
let x = screen_size.width as f64 - window_size.width as f64 - margin;
let y = screen_size.height as f64 - window_size.height as f64 - margin;
let primary_position = primary_monitor.position();
voice_bubble
.set_position(tauri::Position::Physical(tauri::PhysicalPosition {
x: (primary_position.x as f64 + x) as i32,
y: (primary_position.y as f64 + y) as i32,
}))
.unwrap();
}
voice_bubble.show().unwrap();
Reproduction
No response
Expected behavior
No response
Full tauri info
output
[✔] Environment
- OS: Mac OS 14.6.1 arm64 (X64)
✔ Xcode Command Line Tools: installed
✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 20.15.0
- pnpm: 7.33.7
- yarn: 1.22.19
- npm: 8.19.4
[-] Packages
- tauri 🦀: 2.0.5
- tauri-build 🦀: 2.0.1
- wry 🦀: 0.46.2
- tao 🦀: 0.30.3
- @tauri-apps/api : 2.0.2 (outdated, latest: 2.0.3)
- @tauri-apps/cli : 2.0.2 (outdated, latest: 2.0.4)
[-] Plugins
- tauri-plugin-http 🦀: 2.0.2
- @tauri-apps/plugin-http : 2.0.0 (outdated, latest: 2.0.1)
- tauri-plugin-single-instance 🦀: 2.0.1
- @tauri-apps/plugin-single-instance : not installed!
- tauri-plugin-updater 🦀: 2.0.2
- @tauri-apps/plugin-updater : 2.0.0
- tauri-plugin-fs 🦀: 2.0.2
- @tauri-apps/plugin-fs : 2.0.0 (outdated, latest: 2.0.1)
- tauri-plugin-store 🦀: 2.1.0
- @tauri-apps/plugin-store : 2.0.0 (outdated, latest: 2.1.0)
- tauri-plugin-dialog 🦀: 2.0.2
- @tauri-apps/plugin-dialog : 2.0.0 (outdated, latest: 2.0.1)
- tauri-plugin-os 🦀: 2.0.1
- @tauri-apps/plugin-os : 2.0.0
- tauri-plugin-shell 🦀: 2.0.2
- @tauri-apps/plugin-shell : 2.0.0 (outdated, latest: 2.0.1)
- tauri-plugin-sql 🦀: 2.0.1
- @tauri-apps/plugin-sql : 2.0.0
- tauri-plugin-notification 🦀: 2.0.1
- @tauri-apps/plugin-notification : 2.0.0
[-] App
- build-type: bundle
- CSP: default-src 'self';
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: React
- bundler: Vite
Stack trace
No response
Additional context
No response
FabianLars commented
Please include the output of the tauri info
command as required by the issue template.
li-yu-tfs commented
Please include the output of the
tauri info
command as required by the issue template.
Sorry, have updated. pls check again.