pub struct Builder { /* private fields */ }Expand description
Builder for the window-state plugin.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new Builder with the default configuration:
all StateFlags enabled, no denylist, no filter, and the DEFAULT_FILENAME.
Sourcepub fn with_state_flags(self, flags: StateFlags) -> Self
pub fn with_state_flags(self, flags: StateFlags) -> Self
Sets the state flags to control what state gets restored and saved.
Sourcepub fn with_filename(self, filename: impl Into<String>) -> Self
pub fn with_filename(self, filename: impl Into<String>) -> Self
Sets a custom filename to use when saving and restoring window states from disk.
Sourcepub fn with_denylist(self, denylist: &[&str]) -> Self
pub fn with_denylist(self, denylist: &[&str]) -> Self
Sets a list of windows that shouldn’t be tracked and managed by this plugin For example, splash screen windows.
Sourcepub fn with_filter<F>(self, filter_callback: F) -> Self
pub fn with_filter<F>(self, filter_callback: F) -> Self
Sets a filter callback to exclude specific windows from being tracked.
Return true to save the state, or false to skip and not save it.
Sourcepub fn skip_initial_state(self, label: &str) -> Self
pub fn skip_initial_state(self, label: &str) -> Self
Adds the given window label to a list of windows to skip initial state restore.
Sourcepub fn map_label<F>(self, map_fn: F) -> Self
pub fn map_label<F>(self, map_fn: F) -> Self
Transforms the window label when saving the window state.
This can be used to group different windows to use the same state.
Sourcepub fn build<R: Runtime>(self) -> TauriPlugin<R>
pub fn build<R: Runtime>(self) -> TauriPlugin<R>
Builds the TauriPlugin.
The plugin loads the previously saved window state on setup, restores each window’s
state when it becomes ready (unless denylisted, filtered out, or opted out with
Builder::skip_initial_state), tracks move/resize events to keep the state up to date,
and saves the state of all windows to disk when the app exits.