From 63b45e03ab82f045ffaf208b1c22b3304e9ac6b7 Mon Sep 17 00:00:00 2001 From: Mollusk Date: Fri, 19 Jun 2026 03:03:59 -0400 Subject: [PATCH] Windows port: cfg-gate iced window application_id (Linux-only field) iced's `window::settings::PlatformSpecific::application_id` only exists on Linux (X11/Wayland use it to match the .desktop launcher icon); on Windows the struct exposes a different field set, so the unconditional assignment failed to compile for `*-pc-windows-*`. This was the first real Windows compile blocker surfaced now that the port actually cross-compiles. Move the field behind a `platform_specific_settings()` helper gated on `target_os = "linux"`, with a defaults-only variant elsewhere. Linux build unchanged (verified `cargo check`); the windows-gnu target now builds a runnable .exe (verified launching under Wine: GUI renders, iroh network stack + ring identity init, config/identity land in %APPDATA%). Co-Authored-By: Claude Opus 4.8 --- src/app/mod.rs | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/app/mod.rs b/src/app/mod.rs index 4eeee53..530019d 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -553,11 +553,9 @@ pub fn run_gui() -> iced::Result { // the icon from the .desktop file matched by app_id instead). icon: window_icon(), // app_id must match the .desktop basename so Wayland compositors - // (e.g. KWin) attach our launcher icon to the window. - platform_specific: iced::window::settings::PlatformSpecific { - application_id: "peerspeak".to_string(), - ..Default::default() - }, + // (e.g. KWin) attach our launcher icon to the window. The field is + // Linux-only in iced (X11/Wayland); see platform_specific_settings(). + platform_specific: platform_specific_settings(), // We save the final size ourselves on CloseRequested, then exit. exit_on_close_request: false, ..Default::default() @@ -565,6 +563,22 @@ pub fn run_gui() -> iced::Result { .run() } +/// Window `PlatformSpecific` settings. `application_id` (used by X11/Wayland to +/// match our `.desktop` launcher icon) only exists in iced on Linux, so it is +/// set there and left at defaults on Windows. +#[cfg(target_os = "linux")] +fn platform_specific_settings() -> iced::window::settings::PlatformSpecific { + iced::window::settings::PlatformSpecific { + application_id: "peerspeak".to_string(), + ..Default::default() + } +} + +#[cfg(not(target_os = "linux"))] +fn platform_specific_settings() -> iced::window::settings::PlatformSpecific { + iced::window::settings::PlatformSpecific::default() +} + /// Build the window icon from an embedded 128×128 straight-RGBA blob rendered /// from `assets/icons/peerspeak.svg`. Using `from_rgba` (always available) keeps /// us off iced's heavy `image` feature — the blob is raw pixels, no decoder.