Please add an `Application::icon` method

With Iced 0.13.1, to set the application’s icon we have to write something like this, paying attention to the methods’ order:

iced::application("Title", App::update, App::view)
    .window(window::Settings {
        icon: Some(
            window::icon::from_file_data(
                include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/icon.ico")),
                None,
            )
            .expect("icon file should be reachable and in ICO file format"),
        ),
        ..Default::default()
    })
    .window_size((900.0, 260.0))
    .centered()
    .run()

This would be much more convenient:

iced::application("Title", App::update, App::view)
    .window_size((900.0, 260.0))
    .centered()
    .icon(concat!(env!("CARGO_MANIFEST_DIR"), "/icon.ico"))
    .run()
1 Like

Or otherwise:

iced::application("Title", App::update, App::view)
    .window_size((900.0, 260.0))
    .centered()
    .icon(
        window::icon::from_file_data(
            include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/icon.ico")),
            None,
        )
        .expect("icon file should be reachable and in ICO file format")
    )
    .run()
1 Like

Replying to second this. This is fairly useful and could be made easier