emilk/egui

App icon not working on GNOME/Wayland

Barugon opened this issue · 4 comments

Describe the bug
I set the app's icon but it shows as the default GNOME app icon.

To Reproduce
Here's the steps that I used:

  let icon = image::load_from_memory(include_bytes!("../res/icon.png")).unwrap();
  let icon = egui::IconData {
    width: icon.width(),
    height: icon.height(),
    rgba: icon.into_rgba8().into_raw(),
  };

  let viewport = egui::ViewportBuilder::default()
    .with_icon(icon);

  let native = eframe::NativeOptions {
    viewport,
    ..Default::default()
  };

Expected behavior
The correct icon is shown for the app.

Screenshots
Screenshot from 2024-02-06 15-12-03

Desktop (please complete the following information):
Hardware Information:

  • Hardware Model: ASUS PRIME B550-PLUS
  • Memory: 32.0 GiB
  • Processor: AMD Ryzen™ 9 3900X × 24
  • Graphics: AMD Radeon™ RX 7800 XT
  • Disk Capacity: 2.0 TB

Software Information:

  • Firmware Version: 3405
  • OS Name: Fedora Linux 39 (Workstation Edition)
  • OS Build: (null)
  • OS Type: 64-bit
  • GNOME Version: 45.3
  • Windowing System: Wayland
  • Kernel Version: Linux 6.7.3-200.fc39.x86_64

Note that the app icon works fine when using Xorg.

emilk commented

We need a volunteer to add support for this in either winit or in https://github.com/emilk/egui/blob/master/crates/eframe/src/native/app_icon.rs

Note:
The wayland protocol doesn't support setting custom app icons programmatically, see:

https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/52
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/269

Currently the working way to set the app icon is tho install a .desktop file and set the app id to match it.

Note: The wayland protocol doesn't support setting custom app icons programmatically, see:

https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/52 https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/269

Currently the working way to set the app icon is tho install a .desktop file and set the app id to match it.

I have a .desktop file. That works for the GNOME app grid but not the switcher.

Anyway, I'll have a look into this when I have some time.