Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Center windows on macOS with error handling

Richie McIlroy85d931c5a30b
diff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rs
index dd5e48553..230dce20d 100644
--- a/apps/desktop/src-tauri/src/windows.rs
+++ b/apps/desktop/src-tauri/src/windows.rs
@@ -481,10 +481,16 @@ impl ShowCapWindow {
.maximizable(true)
.inner_size(1275.0, 800.0)
.min_inner_size(1275.0, 800.0)
- .center()
.focused(true)
.build()?;
+ #[cfg(target_os = "macos")]
+ {
+ if let Err(e) = window.center() {
+ warn!("Failed to center Editor window on macOS: {}", e);
+ }
+ }
+
#[cfg(windows)]
{
use tauri::LogicalSize;
@@ -515,10 +521,16 @@ impl ShowCapWindow {
.maximizable(true)
.inner_size(1240.0, 800.0)
.min_inner_size(800.0, 600.0)
- .center()
.focused(true)
.build()?;
+ #[cfg(target_os = "macos")]
+ {
+ if let Err(e) = window.center() {
+ warn!("Failed to center ScreenshotEditor window on macOS: {}", e);
+ }
+ }
+
#[cfg(windows)]
{
use tauri::LogicalSize;