mirror of
https://github.com/tiennm99/claude-code-usage-bubble.git
synced 2026-06-06 12:12:29 +00:00
a5dec52aaa
Phase 0 of UI/UX polish pass. Surgical changes, no substrate migration yet. - Extract bar_fill_color + accent_color_for into new src/usage_color.rs so the bubble, panel, and tray badge agree on a single 4-band usage ramp. - Panel: color each bar from its own percent (was using max(5h, 7d) for both rows, so a healthy 5h bar turned red whenever 7d was full). - Light-mode amber #B47A20 (was #E0A040, failed WCAG AA at 2.4:1). - Codex identity: switch from white/charcoal to OpenAI teal #10A37F across bubble, panel stripe, and tray sweep so the surfaces share one brand color and the tray badge stops reading as "loading spinner". - Panel: drop WS_BORDER, add DwmSetWindowAttribute(DWMWCP_ROUND) for Win11 rounded corners. Idempotent re-apply on every show() so the attribute survives any future destroy/recreate path. Silently no-ops on Win10.
71 lines
1.8 KiB
Rust
71 lines
1.8 KiB
Rust
#![windows_subsystem = "windows"]
|
|
// Several modules (creds, usage, update, os::dpi, …) expose API that the
|
|
// app surface doesn't fully call yet — they're scaffolding for in-progress
|
|
// port phases. Allow at the crate root rather than scattering attributes.
|
|
#![allow(dead_code)]
|
|
|
|
// Original infrastructure.
|
|
mod creds;
|
|
mod diag;
|
|
mod i18n;
|
|
mod net;
|
|
mod os;
|
|
mod tray;
|
|
mod update;
|
|
mod usage;
|
|
mod usage_color;
|
|
|
|
// Application surface.
|
|
mod app;
|
|
mod bubble;
|
|
mod panel;
|
|
mod settings;
|
|
|
|
fn main() {
|
|
let args: Vec<String> = std::env::args().collect();
|
|
let diagnose_enabled = args.iter().any(|a| a == "--diagnose");
|
|
if diagnose_enabled {
|
|
if let Ok(Some(path)) = diag::init(true) {
|
|
log::info!("startup args={args:?} log_path={}", path.display());
|
|
}
|
|
}
|
|
|
|
if let Some(exit_code) = update::run_cli(&args) {
|
|
if diagnose_enabled {
|
|
log::info!("cli mode exited with code {exit_code}");
|
|
}
|
|
std::process::exit(exit_code);
|
|
}
|
|
|
|
let wait_pid = args
|
|
.iter()
|
|
.position(|a| a == "--wait-pid")
|
|
.and_then(|i| args.get(i + 1))
|
|
.and_then(|s| s.parse::<u32>().ok());
|
|
if let Some(pid) = wait_pid {
|
|
if diagnose_enabled {
|
|
log::info!("waiting up to 5s for parent pid {pid} to exit");
|
|
}
|
|
update::handoff::wait_for_parent_exit(pid, 5_000);
|
|
}
|
|
|
|
let updated_to = args
|
|
.iter()
|
|
.position(|a| a == "--updated-to")
|
|
.and_then(|i| args.get(i + 1))
|
|
.cloned();
|
|
|
|
if diagnose_enabled {
|
|
log::info!("entering app::run (wait_pid={wait_pid:?} updated_to={updated_to:?})");
|
|
}
|
|
app::run(AppArgs {
|
|
wait_pid_present: wait_pid.is_some(),
|
|
updated_to,
|
|
});
|
|
}
|
|
|
|
pub struct AppArgs {
|
|
pub wait_pid_present: bool,
|
|
pub updated_to: Option<String>,
|
|
}
|