diff options
| author | Brendan Allan <[email protected]> | 2025-12-12 17:04:00 +0800 |
|---|---|---|
| committer | Brendan Allan <[email protected]> | 2025-12-12 17:04:00 +0800 |
| commit | f9d5e1879056dd9507bb1a1645da5b5ede87fcca (patch) | |
| tree | 7a1e7892351a8aec76e4bd422e490faeb9a96a30 | |
| parent | 147111c9c660f4d6e8f25f80d235e12d3441068e (diff) | |
| download | opencode-f9d5e1879056dd9507bb1a1645da5b5ede87fcca.tar.gz opencode-f9d5e1879056dd9507bb1a1645da5b5ede87fcca.zip | |
tauri: create window with full screen size
| -rw-r--r-- | packages/tauri/src-tauri/src/lib.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/tauri/src-tauri/src/lib.rs b/packages/tauri/src-tauri/src/lib.rs index c04faafab..eb712235e 100644 --- a/packages/tauri/src-tauri/src/lib.rs +++ b/packages/tauri/src-tauri/src/lib.rs @@ -4,7 +4,7 @@ use std::{ sync::{Arc, Mutex}, time::{Duration, Instant}, }; -use tauri::{AppHandle, Manager, RunEvent, WebviewUrl, WebviewWindow}; +use tauri::{AppHandle, LogicalSize, Manager, Monitor, RunEvent, WebviewUrl, WebviewWindow}; use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogResult}; use tauri_plugin_shell::process::{CommandChild, CommandEvent}; use tauri_plugin_shell::ShellExt; @@ -169,10 +169,15 @@ pub fn run() { None }; + let primary_monitor = app.primary_monitor().ok().flatten(); + let size = primary_monitor + .map(|m| m.size().to_logical(m.scale_factor())) + .unwrap_or(LogicalSize::new(1920, 1080)); + let mut window_builder = WebviewWindow::builder(&app, "main", WebviewUrl::App("/".into())) .title("OpenCode") - .inner_size(800.0, 600.0) + .inner_size(size.width as f64, size.height as f64) .decorations(true) .zoom_hotkeys_enabled(true) .initialization_script(format!( |
