mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-31 21:48:53 -06:00
app icon: lynx (owner's ArtCraft drawing), Dock/taskbar/launcher wiring, palette docs
- assets/app-icon/: lightcraft.svg (master), lightcraft-small.svg, 1024 PNG, macOS 512 PNG, .icns, .ico, hicolor theme (ai.storyteller.lightcraft), LICENSE.txt, README (palette, geometry, provenance, files) - packaging/icons.sh regenerates everything (resvg, iconutil, new `cargo xtask ico`) - apps/lightcraft: runtime window/Dock icon + Wayland app id; build.rs embeds the .ico and VERSIONINFO into lightcraft.exe (winresource, Windows targets only) - packaging/linux/ai.storyteller.lightcraft.desktop - ATTRIBUTION.md entry; icon at the top of README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ece59f161c
commit
75e4e3ced0
@@ -19,6 +19,10 @@ egui = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
log = { workspace = true }
|
||||
|
||||
[build-dependencies]
|
||||
# Icon + VERSIONINFO for lightcraft.exe; build.rs only uses it when targeting Windows.
|
||||
winresource = "0.1"
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
rfd = { workspace = true }
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
//! Windows only: embed the app icon and version info (VERSIONINFO) into `lightcraft.exe`, so
|
||||
//! Explorer, the taskbar, the Start menu and Alt-Tab show the lynx.
|
||||
//!
|
||||
//! On every other target this does nothing. A missing resource compiler is a warning, so a
|
||||
//! cross-compile from macOS or Linux still links, unless `LIGHTCRAFT_REQUIRE_WINRES=1` turns it
|
||||
//! into an error (for release builds).
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed=../../assets/app-icon/lightcraft.ico");
|
||||
println!("cargo:rerun-if-env-changed=LIGHTCRAFT_REQUIRE_WINRES");
|
||||
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {
|
||||
return;
|
||||
}
|
||||
let mut res = winresource::WindowsResource::new();
|
||||
res.set_icon("../../assets/app-icon/lightcraft.ico")
|
||||
.set("ProductName", "LightCraft")
|
||||
.set("FileDescription", "LightCraft photo library and raw developer")
|
||||
.set("LegalCopyright", "Copyright (c) the LightCraft authors. MIT OR Apache-2.0.")
|
||||
.set("OriginalFilename", "lightcraft.exe")
|
||||
.set("InternalName", "lightcraft");
|
||||
if let Err(e) = res.compile() {
|
||||
if std::env::var_os("LIGHTCRAFT_REQUIRE_WINRES").is_some() {
|
||||
panic!("embedding Windows resources failed: {e}");
|
||||
}
|
||||
println!("cargo:warning=lightcraft.exe built without icon/version resources: {e}");
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,19 @@ mod native_menu;
|
||||
use lightcraft_engine::Session;
|
||||
use lightcraft_ui_egui::{LightcraftApp, Services, UiState};
|
||||
|
||||
/// Reverse-DNS app id: Wayland app id, `.desktop` file and hicolor icon name.
|
||||
const APP_ID: &str = "ai.storyteller.lightcraft";
|
||||
|
||||
/// The window, taskbar and Dock icon (assets/app-icon/, regenerated by packaging/icons.sh). macOS
|
||||
/// gets the version with Apple's transparent margin so it sits right among the other Dock icons.
|
||||
fn app_icon() -> egui::IconData {
|
||||
#[cfg(target_os = "macos")]
|
||||
let png: &[u8] = include_bytes!("../../../assets/app-icon/lightcraft-macos-512.png");
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let png: &[u8] = include_bytes!("../../../assets/app-icon/hicolor/256x256/apps/ai.storyteller.lightcraft.png");
|
||||
eframe::icon_data::from_png_bytes(png).unwrap_or_default()
|
||||
}
|
||||
|
||||
struct App(LightcraftApp, #[cfg(target_os = "macos")] Option<native_menu::NativeMenu>);
|
||||
|
||||
impl eframe::App for App {
|
||||
@@ -251,7 +264,10 @@ fn main() -> eframe::Result {
|
||||
.with_drag_and_drop(true)
|
||||
.with_fullsize_content_view(true)
|
||||
.with_titlebar_shown(false)
|
||||
.with_title_shown(false),
|
||||
.with_title_shown(false)
|
||||
.with_icon(app_icon())
|
||||
// Wayland matches the window to packaging/linux/ai.storyteller.lightcraft.desktop by this id
|
||||
.with_app_id(APP_ID),
|
||||
..Default::default()
|
||||
};
|
||||
eframe::run_native(
|
||||
|
||||
Reference in New Issue
Block a user