iced icon indicating copy to clipboard operation
iced copied to clipboard

Icon doesn't show when using Wayland

Open BonnyAD9 opened this issue 2 years ago • 6 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues.

Is this issue related to iced?

  • [X] My hardware is compatible and my graphics drivers are up-to-date.

What happened?

I set the window icon and start my app with the following code (App implements iced::Application, ../assets/raw_img/icon_64.data is valid raw rgba image with dimensions 64x64):

let mut settings = iced::Settings::default();
settings.window.icon = Some(iced::window::icon::from_rgba(
    include_bytes!("../assets/raw_img/icon_64.data")
        .to_owned()
        .into(),
    64,
    64,
)?);

App::run(settings)?;

The icon shows as expected in the titlebar of the window when using X11, but when using Wayland it shows the wayland icon and not the icon that is in the file.

with X11: image

with Wayland: image

What is the expected behavior?

Show the correct icon (the one in the X11 screenshot), and not the Wayland icon.

Version

crates.io release

Operating System

Linux

Do you have any log output?

DEBUG [iced_winit::application] Window builder: WindowBuilder {
    window: WindowAttributes {
        inner_size: Some(
            Logical(
                LogicalSize {
                    width: 1024.0,
                    height: 768.0,
                },
            ),
        ),
        min_inner_size: None,
        max_inner_size: None,
        position: None,
        resizable: true,
        title: "title",
        fullscreen: None,
        maximized: false,
        visible: false,
        transparent: false,
        decorations: true,
        always_on_top: false,
        window_icon: Some(
            RgbaIcon {
                rgba: [
                    // the image data is here but I removed it to shorten the log
                ],
                width: 64,
                height: 64,
            },
        ),
    },
}
INFO [iced_wgpu::window::compositor] Settings {
    present_mode: AutoVsync,
    internal_backend: VULKAN | GL | METAL | DX12 | DX11 | BROWSER_WEBGPU | PRIMARY | SECONDARY,
    default_font: false,
    default_text_size: 20.0,
    text_multithreading: false,
    antialiasing: None,
}
INFO [iced_wgpu::window::compositor] Available adapters: [
    AdapterInfo {
        name: "AMD Radeon RX 590 Series (RADV POLARIS10)",
        vendor: 4098,
        device: 26591,
        device_type: DiscreteGpu,
        driver: "radv",
        driver_info: "Mesa 23.1.3",
        backend: Vulkan,
    },
    AdapterInfo {
        name: "AMD Radeon RX 590 Series (polaris10, LLVM 15.0.7, DRM 3.52, 6.4.2-arch1-1)",
        vendor: 4098,
        device: 0,
        device_type: Other,
        driver: "",
        driver_info: "",
        backend: Gl,
    },
]
INFO [iced_wgpu::window::compositor] Selected: AdapterInfo {
    name: "AMD Radeon RX 590 Series (RADV POLARIS10)",
    vendor: 4098,
    device: 26591,
    device_type: DiscreteGpu,
    driver: "radv",
    driver_info: "Mesa 23.1.3",
    backend: Vulkan,
}
INFO [iced_wgpu::window::compositor] Selected format: Rgba8UnormSrgb
DEBUG [iced_wgpu::backend] Drawing
INFO [iced_wgpu::image::atlas] Allocated atlas entry: Contiguous(Partial { layer: 0, region: Region { id: AllocId(2), rectangle: Box2D((0, 0), (20, 20)) } })
INFO [iced_wgpu::image::atlas] Current atlas: Atlas { texture: Texture { context: Context { type: "Native" }, id: ObjectId { id: Some(2305843013508661249) }, data: Any { .. }, owned: true, descriptor: TextureDescriptor { label: None, size: Extent3d { width: 2048, height: 2048, depth_or_array_layers: 1 }, mip_level_count: 1, sample_count: 1, dimension: D2, format: Rgba8UnormSrgb, usage: COPY_SRC | COPY_DST | TEXTURE_BINDING, view_formats: [] } }, texture_view: TextureView { context: Context { type: "Native" }, id: ObjectId { id: Some(2305843013508661249) }, data: Any { .. } }, layers: [Busy(Allocator)] }
DEBUG [iced_graphics::image::vector] allocating 5725251527936077720 20x20
INFO [iced_wgpu::image::atlas] Allocated atlas entry: Contiguous(Partial { layer: 0, region: Region { id: AllocId(3), rectangle: Box2D((20, 0), (40, 20)) } })
INFO [iced_wgpu::image::atlas] Current atlas: Atlas { texture: Texture { context: Context { type: "Native" }, id: ObjectId { id: Some(2305843013508661249) }, data: Any { .. }, owned: true, descriptor: TextureDescriptor { label: None, size: Extent3d { width: 2048, height: 2048, depth_or_array_layers: 1 }, mip_level_count: 1, sample_count: 1, dimension: D2, format: Rgba8UnormSrgb, usage: COPY_SRC | COPY_DST | TEXTURE_BINDING, view_formats: [] } }, texture_view: TextureView { context: Context { type: "Native" }, id: ObjectId { id: Some(2305843013508661249) }, data: Any { .. } }, layers: [Busy(Allocator)] }
DEBUG [iced_graphics::image::vector] allocating 2386576014312851155 20x20
INFO [iced_wgpu::image::atlas] Allocated atlas entry: Contiguous(Partial { layer: 0, region: Region { id: AllocId(4), rectangle: Box2D((40, 0), (60, 20)) } })
INFO [iced_wgpu::image::atlas] Current atlas: Atlas { texture: Texture { context: Context { type: "Native" }, id: ObjectId { id: Some(2305843013508661249) }, data: Any { .. }, owned: true, descriptor: TextureDescriptor { label: None, size: Extent3d { width: 2048, height: 2048, depth_or_array_layers: 1 }, mip_level_count: 1, sample_count: 1, dimension: D2, format: Rgba8UnormSrgb, usage: COPY_SRC | COPY_DST | TEXTURE_BINDING, view_formats: [] } }, texture_view: TextureView { context: Context { type: "Native" }, id: ObjectId { id: Some(2305843013508661249) }, data: Any { .. } }, layers: [Busy(Allocator)] }
DEBUG [iced_graphics::image::vector] allocating 8440637452022633712 20x20
DEBUG [iced_wgpu::backend] Drawing

BonnyAD9 avatar Jul 08 '23 16:07 BonnyAD9

Maybe related to https://github.com/GyulyVGC/sniffnet/issues/292

The application needs to set the app id and the same id should be used for StartupWMClass keyword of the desktop entry.

Digitalone1 avatar Jul 09 '23 08:07 Digitalone1

Setting settings.id = Some("uamp".to_owned()); still doesn't show the icon. When I create a desktop file for the app with StartupWMClass=uamp and use it, it also doesn't show the icon.

BonnyAD9 avatar Jul 09 '23 10:07 BonnyAD9

Setting settings.id = Some("uamp".to_owned()); still doesn't show the icon. When I create a desktop file for the app with StartupWMClass=uamp and use it, it also doesn't show the icon.

See https://github.com/GyulyVGC/sniffnet/issues/292#issuecomment-1691384896

Digitalone1 avatar Aug 24 '23 10:08 Digitalone1

Setting settings.id = Some("uamp".to_owned()); still doesn't show the icon. When I create a desktop file for the app with StartupWMClass=uamp and use it, it also doesn't show the icon.

See GyulyVGC/sniffnet#292 (comment)

This shouldn't have anything to do with a .desktop file, the icon should work when it is run from a terminal by calling the binary.

BonnyAD9 avatar Oct 11 '23 11:10 BonnyAD9

This shouldn't have anything to do with a .desktop file, the icon should work when it is run from a terminal by calling the binary.

Maybe with other libraries, but it's not guaranteed with iced.

Iced has issues on showing the app icon on its own, but the desktop entry file specifies an icon name, so desktop environments can workaround these issues alongside the wmclass.

Digitalone1 avatar Oct 11 '23 12:10 Digitalone1