new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Tauri · Develop · all subjects

window customization

11 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

window-state plugin saves and restores window size and position

The window-state plugin automatically saves the size and position of windows when the app closes and restores them when the app reopens.

window-state installation with automatic setup

To install the window-state plugin automatically, run one of these commands from your project root: npm run tauri add window-state, yarn run tauri add window-state, pnpm tauri add window-state, deno task tauri add window-state, bun tauri add window-state, or cargo tauri add window-state.

window-state manual installation with cargo

To manually install the window-state plugin, run 'cargo add tauri-plugin-window-state --target "cfg(any(target_os = "macos", windows, target_os = "linux"))"' in the src-tauri folder.

window-state manual initialization in lib.rs

In src-tauri/src/lib.rs, within the setup closure, add the plugin initialization: app.handle().plugin(tauri_plugin_window_state::Builder::default().build()). This must be wrapped with #[cfg(desktop)].

window-state JavaScript package installation

Install the JavaScript bindings using one of: npm install @tauri-apps/plugin-window-state, yarn add @tauri-apps/plugin-window-state, pnpm add @tauri-apps/plugin-window-state, deno add npm:@tauri-apps/plugin-window-state, or bun add @tauri-apps/plugin-window-state.

saveWindowState JavaScript function for manual state saving

Use the saveWindowState function from @tauri-apps/plugin-window-state with StateFlags to manually save window state: saveWindowState(StateFlags.ALL). This can be accessed via window.__TAURI__.windowState when using 'withGlobalTauri': true.

restoreStateCurrent JavaScript function for manual state restoration

Use the restoreStateCurrent function from @tauri-apps/plugin-window-state with StateFlags to manually restore window state from disk: restoreStateCurrent(StateFlags.ALL). This can be accessed via window.__TAURI__.windowState when using 'withGlobalTauri': true.

save_window_state Rust method for manual state saving

The AppHandleExt trait provides the save_window_state() method on tauri::AppHandle. Call app.save_window_state(StateFlags::all()) to save the state of all open windows to disk.

restore_state Rust method for manual state restoration

The WindowExt trait provides the restore_state() method on Window types. Call window.restore_state(StateFlags::all()) to restore a window's state from disk.

Prevent window flash when restoring state

To prevent windows from flashing when state is restored, set 'visible' to false when creating the window. The plugin will then show the window once it has restored the saved state.

window-state state restoration timing

Window state restoration occurs after window creation, not before.

Give your agent this brain