You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use iced::window;use iced::window::icon;// Assuming you have an icon file named "app_icon.png" in the root of your projectconstICON_BYTES:&[u8] = include_bytes!("../app_icon.png");fnmain() -> iced::Result{// Load the icon from the raw byteslet app_icon = icon::from_file_data(ICON_BYTES,None).expect("Failed to load icon");let configs = CONFIGS.clone();let boot_task_chain = handle_cli_args();let configs1 = Arc::new(Mutex::new(configs));let configs2 = configs1.clone();let newer_release_available1 = Arc::new(Mutex::new(None));let newer_release_available2 = newer_release_available1.clone();// ... (rest of your setup code)letConfigWindow{ size, position, .. } = configs1.lock().unwrap().window;application(SNIFFNET_TITLECASE,Sniffer::update,Sniffer::view).settings(Settings{// id needed for Linux Wayland; should match StartupWMClass in .desktop file; see issue #292id:Some(String::from(SNIFFNET_LOWERCASE)),fonts:vec![Cow::Borrowed(SARASA_MONO_BYTES),Cow::Borrowed(SARASA_MONO_BOLD_BYTES),Cow::Borrowed(ICONS_BYTES),],default_font:Font::with_name(FONT_FAMILY_NAME),default_text_size:Pixels(FONT_SIZE_BODY),antialiasing:false,}).window(window::Settings{size: size.to_size(),// start sizeposition: position.to_position(),min_size:None,// Some(ConfigWindow::MIN_SIZE.to_size()), // min size allowedmax_size:None,visible:true,resizable:true,decorations:true,transparent:false,icon:Some(app_icon),// Set the icon here#[cfg(target_os = "linux")]platform_specific:PlatformSpecific{application_id:String::from(SNIFFNET_LOWERCASE),
..PlatformSpecific::default()},exit_on_close_request:false,
..Default::default()}).subscription(Sniffer::subscription).theme(Sniffer::theme).scale_factor(Sniffer::scale_factor).run_with(move || {(Sniffer::new(&configs1, newer_release_available1),
boot_task_chain,)})}
Yes, I just have to verify whether it correctly sets the icon.
I remember I tried in the past without success, but probably this was fixed in newer iced versions.
Activity
GyulyVGC commentedon Feb 14, 2025
Thanks for the suggestion
ZeroDot1 commentedon Feb 15, 2025
GyulyVGC commentedon Feb 15, 2025
Yes, I just have to verify whether it correctly sets the icon.
I remember I tried in the past without success, but probably this was fixed in newer iced versions.
ZeroDot1 commentedon Feb 15, 2025
OK, I quickly implemented it, it works as shown in the screenshot. the best way is to integrate the function into the main rs.
Here is the code:
cargo:
iced = { version = "0.13.1", features = ["tokio", "svg", "advanced", "lazy", "image"] }main.rs
GyulyVGC commentedon Feb 15, 2025
Awesome, thanks. Feel free to send a PR 😁
ZeroDot1 commentedon Feb 15, 2025
Done via: #717
Add the Titlebaricon solve GyulyVGC#715
fix #715