|
| 1 | +# Codex Usage Widget / Codex 用量桌面小组件 |
| 2 | + |
| 3 | +一个用于 **Windows 桌面右下角悬浮显示** 的 Codex 用量小组件。 |
| 4 | +A lightweight **Windows desktop floating widget** for monitoring Codex usage. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## 功能特点 / Features |
| 9 | + |
| 10 | +- 显示 5 小时窗口与 7 天窗口的用量百分比(已用/剩余) |
| 11 | + Shows usage for both 5-hour and 7-day windows (used/remaining). |
| 12 | +- 每 60 秒自动刷新 |
| 13 | + Auto-refreshes every 60 seconds. |
| 14 | +- 支持透明度调节(20%~100%) |
| 15 | + Adjustable opacity (20%~100%). |
| 16 | +- 支持图层切换(始终置顶 / 普通层级) |
| 17 | + Layer mode switch (always-on-top / normal). |
| 18 | +- 自动跟随系统明暗主题颜色 |
| 19 | + Adapts to system light/dark theme. |
| 20 | +- 游戏模式(自动检测全屏 + 手动强制显示/隐藏,手动优先) |
| 21 | + Game mode (auto full-screen detection + manual force show/hide, manual override has priority). |
| 22 | +- 网络异常时使用本地缓存数据显示 |
| 23 | + Falls back to cached data when network requests fail. |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## 项目结构 / Project Structure |
| 28 | + |
| 29 | +- `codex_usage_widget.ps1`:桌面悬浮窗主程序 |
| 30 | + Main PowerShell widget UI. |
| 31 | +- `codex_usage_fetch.py`:请求 Codex usage 接口并返回 JSON |
| 32 | + Fetches Codex usage data and returns JSON. |
| 33 | +- `启动Codex用量桌显.bat`:一键启动入口(Windows) |
| 34 | + One-click launcher on Windows. |
| 35 | +- `widget_config.json`:界面配置(自动生成) |
| 36 | + UI config file (auto-generated). |
| 37 | +- `last_usage.json`:最近一次成功数据缓存(自动生成) |
| 38 | + Last successful usage cache (auto-generated). |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## 使用方法 / How to Use |
| 43 | + |
| 44 | +### 中文 |
| 45 | +1. 确保你已在本机完成 Codex 登录(本项目会读取本机认证信息)。 |
| 46 | +2. 双击 `启动Codex用量桌显.bat`。 |
| 47 | +3. 右下角出现悬浮窗后,可右键调整透明度与图层。 |
| 48 | +4. 双击悬浮窗可关闭。 |
| 49 | + |
| 50 | +### English |
| 51 | +1. Make sure Codex is already authenticated on your machine. |
| 52 | +2. Double-click `启动Codex用量桌显.bat`. |
| 53 | +3. Right-click the widget to change opacity and layer mode. |
| 54 | +4. Double-click the widget to close it. |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## 依赖 / Requirements |
| 59 | + |
| 60 | +- Windows 10/11 |
| 61 | +- PowerShell 5+ |
| 62 | +- Python 3.x |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +## 说明 / Notes |
| 67 | + |
| 68 | +- 本项目读取本机已有认证文件,不需要在代码里硬编码 token。 |
| 69 | + This project uses local existing auth files and does not require hardcoding tokens in code. |
| 70 | +- 建议不要提交个人认证文件到仓库。 |
| 71 | + Do not commit personal auth credentials to the repository. |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +## License |
| 76 | + |
| 77 | +MIT(可按需改成你自己的许可证) |
| 78 | +MIT (you can change this to your preferred license). |
0 commit comments