Files
punktfunk/crates/punktfunk-tray/build.rs
T
enricobuehler 1be83575b6 feat(host/windows): "Punktfunk Host" identity in Task Manager (icon + version info)
punktfunk-host.exe embedded no icon or version resources, so Task Manager and
Explorer showed a bare lowercase exe name with a generic icon. build.rs now
embeds the branded .ico + FileDescription "Punktfunk Host" / ProductName
"Punktfunk" via winresource (same pattern as the Windows client and the tray;
Linux packaging builds skip the block). The tray gets a matching "Punktfunk
Tray" description, and the SCM display name moves off lowercase
"punktfunk streaming host" to "Punktfunk Host" (applied idempotently by
`service install` on upgrade).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 13:52:55 +00:00

31 lines
1.5 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! Embed the Windows version-info + icon resources into `punktfunk-tray.exe`: ordinal 1 is the
//! exe/file icon, ordinals 26 are the status-variant tray icons `src/win.rs` loads by id
//! (running / stopped / error / streaming / degraded). Same winresource pattern as
//! `clients/windows/build.rs`.
fn main() {
// cfg(windows) is the HOST (skips the Linux/macOS workspace stub build); CARGO_CFG_WINDOWS
// is the TARGET (mirrors the Windows client's build.rs).
#[cfg(windows)]
if std::env::var_os("CARGO_CFG_WINDOWS").is_some() {
let branding = "../../packaging/windows/branding";
let icons = [
(format!("{branding}/punktfunk.ico"), "1"),
(format!("{branding}/punktfunk-tray-running.ico"), "2"),
(format!("{branding}/punktfunk-tray-stopped.ico"), "3"),
(format!("{branding}/punktfunk-tray-error.ico"), "4"),
(format!("{branding}/punktfunk-tray-streaming.ico"), "5"),
(format!("{branding}/punktfunk-tray-degraded.ico"), "6"),
];
let mut res = winresource::WindowsResource::new();
for (path, id) in &icons {
println!("cargo:rerun-if-changed={path}");
res.set_icon_with_id(path, id);
}
// Task Manager / Explorer identity (matches the host's "Punktfunk Host").
res.set("FileDescription", "Punktfunk Tray");
res.set("ProductName", "Punktfunk");
res.compile().expect("embed windows icon resources");
}
}