Repository navigation
Add a clock and usage screen saver with token activity and storage - #2
Closed
dan-zong-hao wants to merge 5 commits into
Closed
dan-zong-hao wants to merge 5 commits into
dan-zong-hao wants to merge 5 commits into
Conversation
- scripts/With-BuildEnvironment.ps1 (new): runs a command with DOTNET_ROOT, the NuGet folders, the .NET CLI home and TEMP pointed at the repository's .local folder when .local/dotnet/dotnet.exe exists. Without it, the machine SDK is used. - scripts/verify.ps1, scripts/run-app.ps1, scripts/B3-Pack.ps1: run through it. - .gitignore: ignore /.local/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Full-screen protection can show a dashboard instead of frosted glass, on demand or on a weekly schedule. Screen saver (src/Curtain.App/Windows/ScreenSaverWindow.xaml, .xaml.cs, .Activity.cs; src/Curtain.App/Controls/TokenActivityChart.cs, ActivitySummaryCharts.cs, FigureText.cs) - Card layout: clock, today's local output, one card per reported 5-hour or 7-day quota with percentage, bar and reset time. - Token activity with a Codex | Claude Code switch: lifetime figures, streaks and a 52-week dot calendar. - Detail pane: 26 weeks as a grid or as 3D columns that rise week by week, busiest day, weekday rhythm and weekly totals. - The last quota reading is kept in %LOCALAPPDATA%\Curtain\quota-cache.json and shown at once; a client that has not answered yet keeps a placeholder card, and new cards fade in instead of shifting the row. Data (src/Curtain.Core/Rendering/, src/Curtain.App/Services/ClientQuotaReader.cs) - PlanQuota, ClientQuotaReader: quota from the signed-in Claude Code and Codex clients. Claude Code runs with DISABLE_AUTOUPDATER so a query never updates it. - CodexActivity: Codex account usage history. - ClaudeTokenHistory: daily Claude Code output tokens from local session logs. Replies count once across resumed sessions; the cache keeps only hashes, offsets and daily sums, so days survive Claude Code's log cleanup. - LocalTokenUsage: today's output tokens for both clients. - ActivityWindow, DailySummary, TokenFormat, QuotaCache. Settings (src/Curtain.Core/Settings/, src/Curtain.App/MainWindow.ScreenSaver.cs, MainWindow.xaml, MainWindow.xaml.cs, Services/ScreenPrivacyManager.cs, Windows/ScreenPrivacyWindow.cs) - Protection style (frosted glass or clock and usage), optional display name and weekly schedules. Client folders come from CLAUDE_CONFIG_DIR and CODEX_HOME, or the defaults in the current user's profile. Tests: tests/Curtain.Core.Tests/ScreenSaverTests.cs. Docs: README sections and screenshots (sample data). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pane that opens from "Explore activity" now has two tabs, Token activity and Storage, and its own Codex | Claude Code switch. Both tabs share one cell, so switching keeps the pane at the same scale; the chosen tab fades in. - src/Curtain.App/Windows/ScreenSaverWindow.Storage.cs (new): the Storage tab. Total, chat storage and month or project count; a bar by category (chats, worktrees or file snapshots, visualizations, plugins and skills, other) that grows in on a new reading; chat storage by month for Codex or by project for Claude Code, largest first. Sizes are measured in the background while the pane is open, at most every ten minutes or on Refresh, shared by all displays. - ScreenSaverWindow.xaml, .Activity.cs: tab and source switches in the pane. The pane can open without activity data and says so in the activity tab. - ScreenSaverWindow.xaml.cs: ClientRoot resolves CODEX_HOME and CLAUDE_CONFIG_DIR, or .codex and .claude in the current user's profile. - src/Curtain.Core/Storage/ClientStorage.cs (new): measures a data folder by top-level rules without following links. Codex categories match the Codex app's own storage page. ProjectDirectory reads the working directory a Claude Code project's session log records, so projects show readable folder names. - Strings (en-US, zh-CN), README, tests/Curtain.Core.Tests/StorageTests.cs. Only file sizes and the first lines of session logs are read. Nothing is changed or deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
B3-Pack requires a FileVersion mapping for every packaged version. These builds were published on the fork for testing. Drop this commit if the upstream release numbering differs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- assets/screen-saver-details.zh-CN.png: the detail pane with Codex token activity in 3D. - assets/screen-saver-storage.zh-CN.png: the Storage tab for Codex and Claude Code side by side. - README.zh-CN.md shows both; README.md links to them. Both use sample data and sample client folders, so no real paths, project names or usage appear. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
补充效果图(均为示例数据,不含真实路径、项目名或用量)。图片也已提交到分支的 |
Owner
|
感谢你花时间为 Curtain 实现这些功能,也谢谢你提供了详细的说明和演示。 Curtain 专注于 Windows 的窗口和桌面隐私保护。时钟屏保、AI 用量统计和存储面板超出了项目的功能范围,因此我们会关闭这条 PR。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



概要
这个 PR 为 Curtain 增加「时钟与用量」屏保、Codex 和 Claude Code 的用量统计,以及屏保详情面板里的「本机存储」标签。改动按功能拆成 5 个提交,可以逐个审阅,也可以只合并其中一部分。
测试安装包(0.4.5-beta.4,自带 .NET 10):https://github.com/dan-zong-hao/Curtain/releases/tag/v0.4.5-beta.4
效果图(示例数据)
提交说明
1. Keep the .NET SDK, NuGet caches and temp files under .local
scripts/With-BuildEnvironment.ps1:项目里有.local/dotnet时,把 SDK、NuGet 缓存、CLI 目录和临时目录都指向.local;没有时照常使用系统 SDK。scripts/verify.ps1、run-app.ps1、B3-Pack.ps1改为通过它运行;.gitignore忽略/.local/。2. Add a clock and usage screen saver
%LOCALAPPDATA%\Curtain\quota-cache.json,打开屏保立即显示上次结果,后台刷新;首次查询时用占位卡片,避免卡片跳动。查询 Claude Code 时设置DISABLE_AUTOUPDATER,查询本身不会触发 Claude Code 更新,也快 2~3 秒。src/Curtain.App/Windows/ScreenSaverWindow.*、src/Curtain.App/Controls/*、src/Curtain.App/Services/ClientQuotaReader.cs、src/Curtain.App/MainWindow.ScreenSaver.cs、src/Curtain.Core/Rendering/*、src/Curtain.Core/Settings/ScreenSaverSchedule.cs、CurtainUserSettings.cs、ScreenPrivacyManager.cs、ScreenPrivacyWindow.cs。3. Add a storage tab to the screen saver's detail pane
cwd),中文目录名也能正常显示。src/Curtain.App/Windows/ScreenSaverWindow.Storage.cs(新增)、ScreenSaverWindow.xaml、.Activity.cs、.xaml.cs,src/Curtain.Core/Storage/ClientStorage.cs(新增),tests/Curtain.Core.Tests/StorageTests.cs(新增)。4. Register local test builds 0.4.5-beta.1 to 0.4.5-beta.4
release/diagnostic-version-map.json增加 0.4.5-beta.1~4,用于 fork 上的测试安装包。如果与上游版本规划冲突,可以直接丢弃这个提交。5. Add detail pane and storage screenshots
assets/screen-saver-details.zh-CN.png和assets/screen-saver-storage.zh-CN.png,README.zh-CN.md中显示,README.md中给出链接。截图使用示例数据和示例客户端文件夹,不含真实路径、项目名或用量。兼容性与隐私
CLAUDE_CONFIG_DIR/CODEX_HOME,未设置时使用当前用户目录下的.claude/.codex。测试
scripts/verify.ps1通过:263 项核心断言(新增屏保计划、额度解析与缓存、Claude 日志统计、存储统计和项目目录读取等用例)、15 项输入断言、Debug / Release 构建。English summary. Adds a clock and usage screen saver (quota cards, today's output, Codex and Claude Code token activity with a 3D detail view, weekly schedules), a cached quota display so cards appear at once, local Claude Code daily statistics, and a Storage tab in the detail pane for the Codex and Claude Code data folders. Five commits, split by feature; the fourth only registers the fork's test versions and can be dropped, and the fifth adds screenshots.
scripts/verify.ps1passes (263 core and 15 input assertions).🤖 Generated with Claude Code