#[non_exhaustive]pub struct WindowState {
pub label: String,
pub title: String,
pub url: String,
pub visible: bool,
pub focused: bool,
pub maximized: bool,
pub minimized: bool,
pub fullscreen: bool,
pub position: (i32, i32),
pub size: (u32, u32),
}Expand description
Current state of a Tauri window including geometry, visibility, and loaded URL.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.label: StringTauri window label (e.g. “main”, “notification”).
title: StringWindow title bar text.
url: StringURL currently loaded in the webview.
visible: boolWhether the window is visible on screen.
focused: boolWhether the window currently has input focus.
maximized: boolWhether the window is maximized.
minimized: boolWhether the window is minimized.
fullscreen: boolWhether the window is in fullscreen mode.
position: (i32, i32)Window position as (x, y) in screen coordinates.
size: (u32, u32)Window dimensions as (width, height) in pixels.
Implementations§
Source§impl WindowState
impl WindowState
Sourcepub fn new(label: impl Into<String>) -> Self
pub fn new(label: impl Into<String>) -> Self
Creates a window state for label with every other field zeroed
(empty title/URL, not visible/focused/maximized/minimized/fullscreen,
position (0, 0), size (0, 0)). Chain the with_* setters to fill it in.
WindowState is #[non_exhaustive]; victauri_plugin::bridge::WebviewBridge
implementors and mock bridges outside this crate build it through this constructor.
§Examples
use victauri_core::WindowState;
let w = WindowState::new("main")
.with_title("My App")
.with_url("http://localhost/")
.with_visible(true)
.with_size(800, 600);
assert_eq!(w.label, "main");
assert_eq!(w.size, (800, 600));
assert!(!w.focused);Sourcepub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
Sets the window title.
Sourcepub fn with_visible(self, visible: bool) -> Self
pub fn with_visible(self, visible: bool) -> Self
Sets whether the window is visible.
Sourcepub fn with_focused(self, focused: bool) -> Self
pub fn with_focused(self, focused: bool) -> Self
Sets whether the window has input focus.
Sourcepub fn with_maximized(self, maximized: bool) -> Self
pub fn with_maximized(self, maximized: bool) -> Self
Sets whether the window is maximized.
Sourcepub fn with_minimized(self, minimized: bool) -> Self
pub fn with_minimized(self, minimized: bool) -> Self
Sets whether the window is minimized.
Sourcepub fn with_fullscreen(self, fullscreen: bool) -> Self
pub fn with_fullscreen(self, fullscreen: bool) -> Self
Sets whether the window is fullscreen.
Sourcepub fn with_position(self, x: i32, y: i32) -> Self
pub fn with_position(self, x: i32, y: i32) -> Self
Sets the window position in screen coordinates.