{"id":30109349,"url":"https://github.com/goniszewski/cctray","last_synced_at":"2025-09-02T13:36:47.577Z","repository":{"id":307250158,"uuid":"1019442518","full_name":"goniszewski/cctray","owner":"goniszewski","description":"macOS menu bar app for monitoring Claude Code usage","archived":false,"fork":false,"pushed_at":"2025-07-25T10:36:30.000Z","size":428,"stargazers_count":20,"open_issues_count":2,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-30T09:12:13.582Z","etag":null,"topics":["ccusage","claude","claude-code","claudecode"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goniszewski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-14T10:30:14.000Z","updated_at":"2025-07-30T03:21:13.000Z","dependencies_parsed_at":"2025-07-30T09:22:29.088Z","dependency_job_id":null,"html_url":"https://github.com/goniszewski/cctray","commit_stats":null,"previous_names":["goniszewski/cctray"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/goniszewski/cctray","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goniszewski%2Fcctray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goniszewski%2Fcctray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goniszewski%2Fcctray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goniszewski%2Fcctray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goniszewski","download_url":"https://codeload.github.com/goniszewski/cctray/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goniszewski%2Fcctray/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269673278,"owners_count":24457117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ccusage","claude","claude-code","claudecode"],"created_at":"2025-08-10T03:43:32.315Z","updated_at":"2025-08-10T03:43:46.260Z","avatar_url":"https://github.com/goniszewski.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# CCTray\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/goniszewski/cctray/main.yml?branch=main\u0026style=for-the-badge)](https://github.com/goniszewski/cctray/actions)\n[![Latest Release](https://img.shields.io/github/v/release/goniszewski/cctray?style=for-the-badge)](https://github.com/goniszewski/cctray/releases)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)\n\nA macOS menu bar application that monitors Anthropic's Claude API usage in real-time. It provides instant visibility into your AI development costs and usage patterns, inspired by the excellent command-line tool [ccowl](https://github.com/sivchari/ccowl).\n\n\u003e **✨ Fun Fact:** This application was developed almost exclusively using Anthropic's Claude.\n\n## 🚀 Features\n\n- **Dynamic Menu Bar Icon**: The app icon provides at-a-glance insights with:\n    - **Color-Coded States**: Green (normal), Yellow (warning), and Red (critical) based on your usage thresholds.\n    - **Pulsing Animation**: A subtle pulse warns you when you're approaching limits.\n    - **Mini Progress Arc**: A circular progress bar around the icon shows token usage percentage.\n- **Rich Data Visualization**: The main view presents data visually for quick comprehension:\n    - **Progress Bars**: See your token usage against limits.\n    - **Trend Indicators**: Small arrows (↗️ ↘️ ↔️) show if your usage is increasing, decreasing, or stable.\n    - **Sparkline Charts**: Mini-graphs display recent usage patterns.\n    - **Color-Coded Metrics**: Key numbers are colored based on semantic thresholds for instant understanding.\n- **Quick Actions**: Access common tasks directly from the main menu:\n    - Copy usage data to the clipboard.\n    - Toggle critical notifications on/off.\n    - Keyboard shortcuts for power users.\n- **Real-time Monitoring**: Live tracking of Claude API usage via the `ccusage` CLI.\n- **Smart Rotating Display**: Cycles through key metrics like cost, burn rate, and remaining session time right in your menu bar.\n- **Deep Customization**: A comprehensive four-tab preferences window lets you control everything from refresh rates to visual thresholds.\n- **Robust \u0026 Efficient**: Features intelligent error handling, automatic Node.js path detection, and is optimized for minimal resource usage.\n\n## 📱 Screenshots\n\nHere are a few glimpses of CCTray in action. For more, check out the full [screenshots directory](screenshots).\n\n|               Menu Bar Icon \u0026 Dropdown                |                             Preferences                              |\n| :---------------------------------------------------: | :------------------------------------------------------------------: |\n| ![CCTray Menu Bar Icon](screenshots/menubar-icon.png) | ![CCTray General Preferences](screenshots/preferences-general-1.png) |\n|            *Real-time usage at a glance.*             |                    *Customize general settings.*                     |\n| ![CCTray Context Menu](screenshots/context-menu.png)  | ![CCTray Display Preferences](screenshots/preferences-display-1.png) |\n|        *Quick actions from the context menu.*         |                      *Fine-tune what you see.*                       |\n\n## 🎯 Requirements\n\n- **macOS 13.0+** (Ventura or later)\n- **Node.js** (any version with npm)\n- **ccusage CLI tool** (`npm install -g ccusage`)\n\n## 📦 Installation\n\n#### 1. Install the CLI Dependency\n\nFirst, ensure you have Node.js and install the `ccusage` CLI tool globally.\n\n```bash\nnpm install -g ccusage\n```\n\n#### 2. Install CCTray\n\n1.  Download the latest `CCTray.dmg` from the [Releases page](https://github.com/goniszewski/cctray/releases).\n2.  Open the DMG and drag `CCTray.app` to your Applications folder.\n3.  Launch CCTray.\n\n## 🎮 Usage\n\n### Basic Operation\n\n1.  **Launch**: CCTray appears as an orange \"C\" in your menu bar.\n2.  **Click**: View detailed usage information in the dropdown menu.\n3.  **Rotating Display**: The menu bar icon cycles through cost → burn rate → remaining time.\n4.  **Preferences**: Click \"Preferences...\" in the dropdown to customize settings.\n\n### Menu Bar States\n\n-   **💤**: No active Claude session.\n-   **⏳**: Loading usage data.\n-   **❌**: Error fetching data from `ccusage`.\n-   **C $X.XX**: Current session cost.\n-   **C XXX/min**: Current burn rate (tokens per minute).\n-   **C XXmin**: Estimated time remaining in the session.\n\n### Understanding Burn Rate Colors\n\n-   **🟢 LOW**: \u003c 300 tokens/min\n-   **🟡 MEDIUM**: 300-700 tokens/min\n-   **🔴 HIGH**: \u003e 700 tokens/min\n\n## ⚙️ Configuration\n\nCCTray is highly customizable via the **Preferences** window, accessible from the menu bar dropdown.\n\nYou can configure:\n-   **General:** Set the data refresh rate and toggle \"Launch at Login\".\n-   **Display:** Control what information is shown (cost, burn rate, etc.), its rotation speed, and the color thresholds for burn rate warnings.\n-   **Advanced:** Manually specify paths for your Node.js executable and the `ccusage` script if auto-detection fails.\n\n## 🛠️ Development\n\n### Building from Source\n\n```bash\n# Clone the repository\ngit clone https://github.com/goniszewski/cctray.git\ncd cctray\n\n# Open in Xcode and run\nopen CCTray.xcodeproj\n```\n\n### Running Tests\n\n```bash\n# Run unit tests from the command line\nxcodebuild test -project CCTray.xcodeproj -scheme CCTray -destination 'platform=macOS'\n\n# Or, run all tests in Xcode using the shortcut Cmd+U\n```\n\n### Architecture Overview\n\nCCTray follows modern SwiftUI patterns, including MVVM architecture, actor-based services for safe concurrency, and `@AppStorage` for persistent state management.\n\n-   `UsageMonitor`: Core business logic and data fetching.\n-   `CommandExecutor`: Secure shell command execution with caching.\n-   `AppPreferences`: User settings with persistent storage.\n-   `PreferencesView`: The four-tab settings interface.\n\n## 🔧 Troubleshooting\n\n#### \"Command not found\" or Menu Bar shows \"❌\"\n\nThis usually means CCTray cannot find or execute the `ccusage` command.\n\n1.  **Verify `ccusage`:** Open Terminal and run `ccusage --version`. If this fails, reinstall it with `npm install -g ccusage`.\n2.  **Check Node.js Path:** CCTray automatically detects Node.js installations from Homebrew, nvm, and standard system paths. If you have a custom setup, you may need to set the path manually.\n    -   Find your Node.js path: `which node`\n    -   Go to CCTray **Preferences → Advanced** and paste the full path into the \"Node.js Command\" field.\n3.  **Check `ccusage` Path:** If you installed `ccusage` in a non-standard location, you can also specify its path in the Advanced preferences.\n    -   Find your `ccusage` path: `npm list -g ccusage`\n    -   Copy the path to the main script (e.g., `.../lib/node_modules/ccusage/dist/index.js`) and paste it into the \"ccusage Script\" field.\n\n#### High CPU Usage\n\n-   Increase the **Update Interval** in **Preferences → General** to a higher value (e.g., 10-15 seconds). CCTray uses exponential backoff during errors to prevent high CPU usage, but frequent updates can still be resource-intensive.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to fork the repository, make changes, and open a pull request.\n\n1.  Fork the repository.\n2.  Create a feature branch (`git checkout -b feature/amazing-feature`).\n3.  Commit your changes following the convention below.\n4.  Push to the branch (`git push origin feature/amazing-feature`).\n5.  Open a Pull Request.\n\n### Commit Messages\n\nThis project uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). Please structure your commit messages accordingly. This helps in automating changelogs and makes the history more readable.\n\n**Examples:**\n-   `feat: Add new burn rate color option`\n-   `fix: Correctly parse cost from JSON output`\n-   `docs: Update README with installation instructions`\n-   `refactor: Improve performance of data fetching service`\n\n## 🙏 Acknowledgements\n\n-   This project was heavily inspired by the functionality of [ccowl](https://github.com/sivchari/ccowl) by [@sivchari](https://github.com/sivchari).\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n**Made with ❤️ for the Claude community**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoniszewski%2Fcctray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoniszewski%2Fcctray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoniszewski%2Fcctray/lists"}