From e100c165fba1ff6955a7701b5adbef541653581b Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 15 Oct 2026 19:02:40 +0700 Subject: [PATCH] #346: FreeBSD's desktop entry matches the window class there (the binary's name) --- apps/figcraft/src/main.rs | 2 ++ packaging/freebsd/package.sh | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/figcraft/src/main.rs b/apps/figcraft/src/main.rs index 73f82051..51305640 100644 --- a/apps/figcraft/src/main.rs +++ b/apps/figcraft/src/main.rs @@ -177,6 +177,8 @@ fn main() -> eframe::Result { control_server::start(p, queue.clone(), ctx_slot.clone()); } let icon = services::window_icon(); + // The app id is the Wayland app_id and the X11 window class on Linux: the desktop entry's name + // and StartupWMClass (FreeBSD's package matches the binary's name instead). let mut viewport = egui::ViewportBuilder::default() .with_title("FigCraft") .with_app_id("ai.storyteller.figcraft") diff --git a/packaging/freebsd/package.sh b/packaging/freebsd/package.sh index 69316765..bb9a7799 100755 --- a/packaging/freebsd/package.sh +++ b/packaging/freebsd/package.sh @@ -76,8 +76,11 @@ for b in "${BINS[@]}"; do install -m 755 "$BIN/$b" "$STAGE/bin/" strip "$STAGE/bin/$b" 2>/dev/null || true done -# The desktop entry, MIME type, metainfo and icons are the freedesktop files Linux ships. -install -m 644 "$LINUX/$APP_ID.desktop" "$STAGE/share/applications/$APP_ID.desktop" +# The desktop entry, MIME type, metainfo and icons are the freedesktop files Linux ships. The +# window's X11 class is the binary's name here (egui-winit names the window after the app id on +# Linux only), so the entry matches that. +sed -e "s/^StartupWMClass=.*/StartupWMClass=figcraft/" "$LINUX/$APP_ID.desktop" >"$STAGE/share/applications/$APP_ID.desktop" +chmod 644 "$STAGE/share/applications/$APP_ID.desktop" install -m 644 "$LINUX/$APP_ID.mime.xml" "$STAGE/share/mime/packages/$APP_ID.xml" sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$FIGCRAFT_BUILD_DATE/g" \ "$LINUX/$APP_ID.metainfo.xml.in" >"$STAGE/share/metainfo/$APP_ID.metainfo.xml"