#window-state and StateFlags

5 messages · Page 1 of 1 (latest)

vague spire
#

I've installed https://github.com/tauri-apps/tauri-plugin-window-state and I let it handle the saving/loading of window state alone. But I noticed that it messes up with my splashscreen.

Splashcreen appear, and main window also appear (full white and unloead) because of the window state loading. Then splashscreen disappear correctly.

Is there a way to ignore some of the StateFlags while still using the automatic handle of things to avoid window-state loading visible flag of my main window?

GitHub

[READ ONLY] This repository is a mirror, for issue tracking and development head to: https://github.com/tauri-apps/plugins-workspace - GitHub - tauri-apps/tauri-plugin-window-state: [READ ONLY] Thi...

analog wedge
#

I think you have 2 options here:

  1. tell the plugin to completely ignore your main window on app start via skip_initial_state which is probably not what you want

  2. Use the build'ers with_state_flags to disable the visibility state. Untested but should look something like this ```rs
    fn main() {
    let mut flags = StateFlags::all();
    flags.remove(StateFlags::VISIBLE);

    tauri::Builder::default()
    .plugin(tauri_plugin_window_state::Builder::default()
    .with_state_flags(flags)
    .build())
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
    }

vague spire
#

Option 2 seems to be what I want to achieve, but with_state_flags do not seem to exists:

error[E0599]: no method named `with_state_flags` found for struct `tauri_plugin_window_state::Builder` in the current scope
  --> src\main.rs:38:14
   |
38 |             .with_state_flags(flags)
   |              ^^^^^^^^^^^^^^^^ method not found in `tauri_plugin_window_state::Builder

It strange, it seems to be present on the github repo, but not in my project 🤔

#

Nevermind, I installed the wrong dep, it seems to work, thanks a lot !

ashen perch
#

I'm having the same issue, did you found the solution @vague spire ?