Skip to content

Commit 0e85c75

Browse files
committed
tweak claude statusline
1 parent 27dfc97 commit 0e85c75

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

ai/claude/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"model": "opus[1m]",
2+
"model": "sonnet",
33
"statusLine": {
44
"type": "command",
55
"command": "node ~/.claude/statusline.js"

ai/claude/statusline.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ try {
8484
sections.push({ text: `${percent}%`, bgColor, color });
8585
}
8686

87+
// Rate limit usage
88+
const rateLimits = input.rate_limits;
89+
if (rateLimits?.five_hour && rateLimits?.seven_day) {
90+
const fiveH = Math.round(rateLimits.five_hour.used_percentage);
91+
const sevenD = Math.round(rateLimits.seven_day.used_percentage);
92+
const maxPct = Math.max(fiveH, sevenD);
93+
const bgColor = maxPct > 75 ? "rgb(226, 0, 0)" : maxPct > 50 ? "rgb(217, 119, 87)" : "rgb(68, 68, 68)";
94+
const color = maxPct > 50 ? "rgb(0, 0, 0)" : "rgb(255, 255, 255)";
95+
sections.push({ text: `5h:${fiveH}% 7d:${sevenD}%`, bgColor, color });
96+
}
97+
8798
console.log(formatSections(sections));
8899
} catch (error) {
89100
console.error('Error:', error.message);

0 commit comments

Comments
 (0)