Add Tauri config, Cargo.toml, capabilities

This commit is contained in:
megaproxy 2026-05-09 00:00:55 +01:00
parent c6d8e902f6
commit 8abb0599f6
5 changed files with 146 additions and 0 deletions

52
src-tauri/Cargo.toml Normal file
View file

@ -0,0 +1,52 @@
[package]
name = "claude-usage-widget"
version = "0.1.0"
description = "Always-on-top Windows widget visualizing local Claude Code usage"
authors = ["megaproxy"]
edition = "2021"
rust-version = "1.77"
[lib]
name = "claude_usage_widget_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies]
tauri-build = { version = "2", features = [] }
[dependencies]
tauri = { version = "2", features = [] }
tauri-plugin-autostart = "2"
tauri-plugin-store = "2"
tauri-plugin-dialog = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
chrono = { version = "0.4", features = ["serde"] }
notify = "6"
notify-debouncer-full = "0.3"
walkdir = "2"
anyhow = "1"
thiserror = "1"
tokio = { version = "1", features = ["full"] }
dirs = "5"
once_cell = "1"
parking_lot = "0.12"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
[target.'cfg(windows)'.dependencies]
windows = { version = "0.58", features = ["Win32_System_Console"] }
[features]
# Default: production binary (no console window on Windows)
default = ["custom-protocol"]
custom-protocol = ["tauri/custom-protocol"]
[profile.release]
panic = "abort"
codegen-units = 1
lto = true
opt-level = "s"
strip = true

3
src-tauri/build.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}

View file

@ -0,0 +1,22 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capabilities granted to the main window. FS reads happen Rust-side, so no fs:* permissions are needed.",
"windows": ["main"],
"permissions": [
"core:default",
"core:event:allow-listen",
"core:event:allow-unlisten",
"core:event:allow-emit",
"core:event:allow-emit-to",
"core:window:allow-start-dragging",
"core:window:allow-set-position",
"core:window:allow-close",
"core:window:allow-hide",
"core:window:allow-show",
"core:app:allow-version",
"autostart:default",
"store:default",
"dialog:default"
]
}

13
src-tauri/icons/README.md Normal file
View file

@ -0,0 +1,13 @@
# Icons
Placeholder. Before `pnpm tauri build` will succeed you need real icons here.
Quickest path: `pnpm tauri icon path/to/source-1024x1024.png` — Tauri generates every required size + format (`.ico`, `.icns`, `.png`).
Files Tauri's bundler expects (referenced from `tauri.conf.json`):
- `32x32.png`
- `128x128.png`
- `128x128@2x.png`
- `icon.icns`
- `icon.ico`

56
src-tauri/tauri.conf.json Normal file
View file

@ -0,0 +1,56 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Claude Usage Widget",
"version": "0.1.0",
"identifier": "com.megaproxy.claude-usage-widget",
"build": {
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm build",
"devUrl": "http://localhost:1420",
"frontendDist": "../dist"
},
"app": {
"windows": [
{
"label": "main",
"title": "Claude Usage",
"width": 280,
"height": 360,
"minWidth": 280,
"minHeight": 360,
"resizable": false,
"decorations": false,
"transparent": true,
"alwaysOnTop": true,
"skipTaskbar": true,
"shadow": false,
"center": false,
"x": 40,
"y": 40,
"visible": true
}
],
"security": {
"csp": "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'"
}
},
"plugins": {
"autostart": {
"args": ["--minimized"]
}
},
"bundle": {
"active": true,
"targets": ["nsis"],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"category": "Utility",
"shortDescription": "At-a-glance Claude Code usage on the Windows desktop",
"longDescription": "Floating, always-on-top widget that visualizes your current 5-hour Claude Code session block, the past 7 days of usage, and a per-model breakdown. Reads JSONL transcripts directly from the Claude Code config directory — no Anthropic API, no auth."
}
}