diff --git a/assets/pixelpass-256.png b/assets/pixelpass-256.png new file mode 100644 index 0000000..601c8dc Binary files /dev/null and b/assets/pixelpass-256.png differ diff --git a/assets/pixelpass.desktop b/assets/pixelpass.desktop index 16106a5..73d1964 100644 --- a/assets/pixelpass.desktop +++ b/assets/pixelpass.desktop @@ -5,6 +5,7 @@ GenericName=Screen Sharing Comment=P2P screen sharing over iroh — no port forwarding, no signup Exec=pixelpass --gui Icon=pixelpass +StartupWMClass=pixelpass Terminal=false Categories=Network;RemoteAccess; Keywords=screen;share;sharing;remote;p2p;iroh;cast; diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 4d24177..02715b5 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -18,11 +18,25 @@ use self::child::{ChildEvent, ChildProc}; /// Launch the GUI event loop. Blocks until the window is closed. Runs on the /// main thread (a winit requirement), which is where `main` calls it from. pub fn run() -> anyhow::Result<()> { + // `app_id` must match the installed `pixelpass.desktop`: on Wayland the + // compositor sources the titlebar/taskbar icon from that desktop file's + // `Icon=` keyed by app_id — not from any pixels the app sets. + let mut viewport = egui::ViewportBuilder::default() + .with_app_id("pixelpass") + .with_inner_size([520.0, 480.0]) + .with_min_inner_size([460.0, 380.0]) + .with_title("PixelPass"); + + // Pixel icon for X11 titlebars (`_NET_WM_ICON`), embedded at compile time + // so the single binary stays self-contained. Non-fatal on failure: Wayland + // already has its icon via app_id, and X11 just keeps the generic fallback. + match eframe::icon_data::from_png_bytes(include_bytes!("../../assets/pixelpass-256.png")) { + Ok(icon) => viewport = viewport.with_icon(icon), + Err(e) => tracing::warn!("could not load embedded window icon: {e}"), + } + let options = eframe::NativeOptions { - viewport: egui::ViewportBuilder::default() - .with_inner_size([520.0, 480.0]) - .with_min_inner_size([460.0, 380.0]) - .with_title("PixelPass"), + viewport, ..Default::default() };