@patrickdappollonio/claude-usage-tray 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Patrick D'appollonio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # @patrickdappollonio/claude-usage-tray
2
+
3
+ A minimal tray icon that shows your Claude Code subscription usage: the 5-hour
4
+ session percentage and the 7-day weekly percentage, with reset times. It lives
5
+ in the Linux system tray (StatusNotifierItem) and in the macOS menu bar.
6
+
7
+ This package ships prebuilt binaries for `linux-x64`, `linux-arm64`,
8
+ `darwin-x64` and `darwin-arm64`. The Linux ones are statically linked.
9
+
10
+ ## Usage
11
+
12
+ Run it without installing:
13
+
14
+ ```sh
15
+ npx @patrickdappollonio/claude-usage-tray
16
+ ```
17
+
18
+ Or install it globally:
19
+
20
+ ```sh
21
+ npm install -g @patrickdappollonio/claude-usage-tray
22
+ claude-usage-tray hook install # wire up the Claude Code statusline
23
+ claude-usage-tray # run the tray
24
+ ```
25
+
26
+ `hook install` records the **absolute path** of the binary it was run from, so
27
+ re-run it after upgrading the package.
28
+
29
+ ## Requirements
30
+
31
+ - Linux with a StatusNotifierItem host: KDE Plasma, XFCE 4.16+, LXQt, Cinnamon
32
+ or MATE work out of the box. GNOME needs the
33
+ [AppIndicator and KStatusNotifierItem Support](https://extensions.gnome.org/extension/615/appindicator-support/)
34
+ extension.
35
+ - Or macOS 12 or newer, where the icon goes in the menu bar. Notifications are
36
+ best effort here: npm ships the bare binary, and macOS only delivers
37
+ notifications properly on behalf of an app bundle. For real Notification
38
+ Center banners, grab the `.app` from the
39
+ [releases page](https://github.com/patrickdappollonio/claude-usage-tray/releases/latest)
40
+ instead. Everything else behaves the same.
41
+ - Claude Code >= 2.1.80 (the version that added `rate_limits` to the statusline
42
+ JSON), on a Pro/Max subscription account.
43
+
44
+ ## No network calls, no credentials
45
+
46
+ This tray makes zero network requests and never reads your Claude credentials.
47
+ It only reads a local JSON file — the data Claude Code itself already hands to
48
+ your statusline on stdin.
49
+
50
+ Full documentation:
51
+ <https://github.com/patrickdappollonio/claude-usage-tray>
52
+
53
+ ## License
54
+
55
+ MIT. See `LICENSE`.
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "node:child_process";
4
+ import { existsSync } from "node:fs";
5
+ import path from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+
11
+ const PLATFORM_TARGETS = [
12
+ { platform: "darwin", arch: "x64", key: "darwin-x64" },
13
+ { platform: "darwin", arch: "arm64", key: "darwin-arm64" },
14
+ { platform: "linux", arch: "x64", key: "linux-x64" },
15
+ { platform: "linux", arch: "arm64", key: "linux-arm64" }
16
+ ];
17
+
18
+ const current = PLATFORM_TARGETS.find(
19
+ (target) => target.platform === process.platform && target.arch === process.arch
20
+ );
21
+
22
+ if (!current) {
23
+ throw new Error(
24
+ `Unsupported platform combination: ${process.platform}/${process.arch}. ` +
25
+ "Please open an issue to request support: " +
26
+ "https://github.com/patrickdappollonio/claude-usage-tray/issues/new"
27
+ );
28
+ }
29
+
30
+ const binaryName = "claude-usage-tray";
31
+ const vendorRoot = path.join(__dirname, "..", "vendor", current.key);
32
+ const binaryPath = path.join(vendorRoot, binaryName);
33
+
34
+ if (!existsSync(binaryPath)) {
35
+ throw new Error(
36
+ `claude-usage-tray binary not found for ${current.key}. ` +
37
+ "Please reinstall the package or open an issue: " +
38
+ "https://github.com/patrickdappollonio/claude-usage-tray/issues/new"
39
+ );
40
+ }
41
+
42
+ const child = spawn(binaryPath, process.argv.slice(2), {
43
+ stdio: "inherit",
44
+ env: process.env
45
+ });
46
+
47
+ child.on("error", (err) => {
48
+ console.error(`Failed to start claude-usage-tray: ${err.message}`);
49
+ process.exit(1);
50
+ });
51
+
52
+ child.on("exit", (code, signal) => {
53
+ if (signal) {
54
+ process.kill(process.pid, signal);
55
+ return;
56
+ }
57
+ process.exit(code ?? 1);
58
+ });
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@patrickdappollonio/claude-usage-tray",
3
+ "version": "0.1.0",
4
+ "description": "Tray icon showing Claude Code 5-hour and weekly usage, for Linux and macOS.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "claude-usage-tray": "bin/claude-usage-tray.js"
9
+ },
10
+ "files": [
11
+ "bin",
12
+ "vendor",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/patrickdappollonio/claude-usage-tray"
19
+ },
20
+ "keywords": [
21
+ "claude",
22
+ "claude-code",
23
+ "usage",
24
+ "tray",
25
+ "statusnotifieritem",
26
+ "menubar",
27
+ "linux",
28
+ "macos",
29
+ "cli"
30
+ ],
31
+ "engines": {
32
+ "node": ">=18"
33
+ }
34
+ }