app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

commit 0d64bb263df61730fb202f0dde55e79476c8359d
parent 0039b24e288574ccdc5bea5fc954f96823791797
Author: triesap <tyson@radroots.org>
Date:   Sat, 21 Mar 2026 12:40:32 +0000

desktop: add app icon for native runs

- add the copied desktop icon asset under crates/desktop/assets/icons
- decode the desktop icon into egui icon data and attach it through the viewport builder
- add the workspace image dependency needed for ico decoding in the desktop launcher
- keep the desktop icon path cross-platform and app-owned instead of using apple-specific resource naming

Diffstat:
MCargo.lock | 1+
MCargo.toml | 1+
Mcrates/desktop/Cargo.toml | 1+
Acrates/desktop/assets/icons/radroots-logo.ico | 0
Mcrates/desktop/src/main.rs | 30+++++++++++++++++++++++++++---
5 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -2810,6 +2810,7 @@ dependencies = [ "directories", "eframe", "egui", + "image", "objc2-foundation 0.3.2", "radroots-app-apple-security", "radroots-app-core", diff --git a/Cargo.toml b/Cargo.toml @@ -24,6 +24,7 @@ android_logger = "0.15.1" directories = "6" eframe = { version = "0.33.3", default-features = false, features = ["android-game-activity", "default_fonts", "glow", "wgpu", "wayland", "x11"] } egui = { version = "0.33.3", features = ["serde"] } +image = { version = "0.25.10", default-features = false, features = ["ico", "png"] } jni = "0.21.1" log = "0.4.28" ndk-context = "0.1.1" diff --git a/crates/desktop/Cargo.toml b/crates/desktop/Cargo.toml @@ -18,6 +18,7 @@ workspace = true directories.workspace = true eframe.workspace = true egui.workspace = true +image.workspace = true radroots-app-core = { path = "../core" } radroots-nostr-accounts.workspace = true diff --git a/crates/desktop/assets/icons/radroots-logo.ico b/crates/desktop/assets/icons/radroots-logo.ico Binary files differ. diff --git a/crates/desktop/src/main.rs b/crates/desktop/src/main.rs @@ -3,6 +3,7 @@ use directories::BaseDirs; use eframe::egui; +use image::ImageFormat; #[cfg(target_os = "macos")] use radroots_app_apple_security::{APPLE_NOSTR_SERVICE, RadrootsAppleKeychainVault}; use radroots_app_core::{ @@ -16,6 +17,8 @@ use radroots_nostr_accounts::prelude::{ use std::path::{Path, PathBuf}; use std::sync::Arc; +const RADROOTS_DESKTOP_ICON_BYTES: &[u8] = include_bytes!("../assets/icons/radroots-logo.ico"); + #[cfg(target_os = "macos")] fn set_macos_app_name() { use objc2_foundation::{NSProcessInfo, NSString}; @@ -28,6 +31,18 @@ fn set_macos_app_name() { #[cfg(not(target_os = "macos"))] fn set_macos_app_name() {} +fn desktop_icon() -> Option<egui::IconData> { + let image = + image::load_from_memory_with_format(RADROOTS_DESKTOP_ICON_BYTES, ImageFormat::Ico).ok()?; + let image = image.into_rgba8(); + let (width, height) = image.dimensions(); + Some(egui::IconData { + rgba: image.into_raw(), + width, + height, + }) +} + struct DesktopBackend; impl DesktopBackend { @@ -210,10 +225,19 @@ impl RadrootsAppBackend for DesktopBackend { fn main() -> eframe::Result<()> { set_macos_app_name(); - let options = eframe::NativeOptions { - viewport: egui::ViewportBuilder::default() + let viewport = { + let viewport = egui::ViewportBuilder::default() .with_inner_size([1280.0, 820.0]) - .with_min_inner_size([480.0, 320.0]), + .with_min_inner_size([480.0, 320.0]); + if let Some(icon) = desktop_icon() { + viewport.with_icon(icon) + } else { + viewport + } + }; + + let options = eframe::NativeOptions { + viewport, ..Default::default() };