Files
portmaster/desktop/tauri/src-tauri
Alexandr Stelnykovych 8dbd61215b feat: implement debounced window state saving for shutdown resilience
- Add create_debounced_window_state_saver() function in window.rs
- Extract WINDOW_STATE_FLAGS_TO_SAVE and WINDOW_STATE_SAVE_TIMEOUT constants
- Listen to tauri://move and tauri://resize events with 5-second debouncing
- Automatically save window state after positioning changes settle
- Prevent window position loss during system shutdowns/restarts

The debouncing mechanism avoids excessive disk I/O during active window
manipulation while ensuring recent position changes are preserved even
when the application doesn't close normally.

Fixes window position being lost when system restarts before user
manually closes the application.
https://github.com/safing/portmaster/issues/2011
2025-09-04 23:36:01 +03:00
..
2025-08-05 16:45:14 +03:00
2025-08-05 16:45:14 +03:00

Update Tauri guide

Check latest versions of tauri packages and update them accordingly (https://crates.io/)
Cargo.toml:

[build-dependencies]
tauri-build = { version = "2.0.0-beta.19", features = [] } # Update to latest

[dependencies]
# Tauri
tauri = { version = "2.0.0-beta.24", features = ["tray-icon", "image-png", "config-json5", "devtools"] } # Update to latest
tauri-plugin-shell = "2.0.0-beta"
tauri-plugin-dialog = "2.0.0-beta"
tauri-plugin-clipboard-manager = "2.0.0-beta"
tauri-plugin-os = "2.0.0-beta"
tauri-plugin-single-instance = "2.0.0-beta"
tauri-plugin-cli = "2.0.0-beta"
tauri-plugin-notification = "2.0.0-beta"
tauri-plugin-log = "2.0.0-beta"
tauri-plugin-window-state = "2.0.0-beta"

tauri-cli = "2.0.0-beta.21" # Update to latest

Run:

cargo update

Make sure to update the npm tauri plugin dependencies to have the same version as the rust plugins. (desktop/angular)

Update WIX installer template

If the migration functionality is not needed anymore remove the template, this will cause tauri to use its default template and not call the migration script.

  1. Get the latest main.wxs template from the repository.
  2. Replace the contents of templates/wix/main_original.wxs with the repository version. (The file is kept only for reference)
  3. Replace the contents of templates/wix/main.wsx and add the fallowing lines at the end of the file, inside the Product tag.
    <!-- Service fragments -->
    <CustomActionRef Id='MigrationPropertySet' />
    <CustomActionRef Id='Migration' />
    <!-- Uncommenting the next line will cause the installer to check if the old service is running and fail. Without it, it will automatically stop and remove the old service without notifying the user. -->
    <!-- <CustomActionRef Id='CheckServiceStatus' /> -->
    <!-- End Service fragments -->