How to close window but keep app running

I would like to implement an app like this. The app would run continuously in the background and try to receive messages from the socket, when a message arrives, a xilem window would pop up in the middle of the screen displaying the content of the message, and the user would view the message and close the window, and do the same the next time a message arrives.
My needs are the same as the issue,Someone gave the advice that use winit set window visible and the example were mentioned, but it’s too complicated for me. Is there an easy way to get winit handle? Or is there any other way to accomplish what I need :wink:

I modified the example/events, but the second time it loops it creates the window with an error

So you can declare Settings and hide ‘decorations’ by disabling it in main function.
And make a custom exit button to hide or move main window.

fn main() -> iced::Result {
    let height = 250.0;
    let width = 400.0;
    let x =960.0;
    let y = 480.0;
    
    let settings = Settings {
        window: window::Settings {
            size: (Size::new(width,height)),
            exit_on_close_request: false,
            decorations: false,
                ..Default::default()},
            ..Default::default()
        },
        ..Default::default()
    };
    CalendarApp::run(settings)
}

If you use the latest version of ICED and use the iced::daemon directly the application does not stop when the last window closes. See the multi_window example here iced/examples/multi_window/src/main.rs at master · iced-rs/iced · GitHub

1 Like