Files
claude-code-usage-bubble/build.rs
T
tiennm99 c0f3e3f860 feat: initial port of claude-code-usage-monitor as a floating bubble
Windows-only floating, draggable circular bubble showing Claude Code
and Codex usage. Derivative of CodeZeno/Claude-Code-Usage-Monitor (MIT),
relicensed under Apache 2.0 with upstream attribution in NOTICE.

- Ported verbatim: poller, updater, tray_icon, theme, localization,
  diagnose, models (~2,700 LOC)
- Original: bubble (circular layered window, drag-anywhere via
  WM_NCHITTEST+HTCAPTION, snap-to-edge, Ctrl+Wheel resize, auto-hide
  on fullscreen), panel (expanded 5h/7d view), app (orchestrator,
  single-instance mutex, polling thread, context menu, dual-bubble
  lifecycle), settings (settings.json persistence)
- Cargo.toml features cover Win32 GDI, HiDpi, Registry, Threading,
  Shell, WindowsAndMessaging, and KeyboardAndMouse
2026-05-15 21:27:31 +07:00

25 lines
942 B
Rust

use winres::{VersionInfo, WindowsResource};
fn main() {
let version = env!("CARGO_PKG_VERSION");
let mut res = WindowsResource::new();
let numeric_version = pack_version(version);
res.set_icon("src/icons/icon.ico")
.set("FileVersion", version)
.set("ProductVersion", version)
.set_version_info(VersionInfo::FILEVERSION, numeric_version)
.set_version_info(VersionInfo::PRODUCTVERSION, numeric_version);
res.compile().expect("Failed to compile Windows resources");
}
fn pack_version(version: &str) -> u64 {
let core = version.split('-').next().unwrap_or(version);
let mut parts = core.split('.').map(|p| p.parse::<u64>().unwrap_or(0));
let major = parts.next().unwrap_or(0).min(u16::MAX as u64);
let minor = parts.next().unwrap_or(0).min(u16::MAX as u64);
let patch = parts.next().unwrap_or(0).min(u16::MAX as u64);
(major << 48) | (minor << 32) | (patch << 16)
}