A GNOME Shell extension that displays your Claude Code token usage directly in your system panel. Monitor your session and weekly token consumption at a glance with visual progress bars and status indicators.
- Real-time Usage Monitoring: Track your Claude Code token usage in the GNOME panel
- Session & Weekly Limits: View both current session and weekly usage percentages
- Visual Progress Bars: Easy-to-read progress bars showing consumption levels
- Smart Status Icons: Icons change based on usage levels
- Happy (below 80%)
- Warning (80-99%)
- Alert (100% or maxed out)
- Auto-refresh: Automatically updates every 5 minutes
- Manual Refresh: Click to refresh usage data on demand
- Reset Timers: See when your session and weekly limits reset
The extension shows:
- Percentage indicator in the panel
- Dropdown menu with detailed session and weekly usage
- Progress bars for visual representation
- Next reset times for both session and weekly limits
- GNOME Shell 42, 45, or 46
- Python 3
pexpectPython library- Claude Code CLI installed and configured
pip install pexpectClone this repository to your GNOME extensions directory:
git clone https://github.com/yourusername/claude-usage-checker.git \
~/.local/share/gnome-shell/extensions/claude-usage-checker@DiogoValdrez.github.comRestart GNOME Shell:
- On X11: Press
Alt+F2, typer, and press Enter - On Wayland: Log out and log back in
Then enable the extension:
gnome-extensions enable claude-usage-checker@DiogoValdrez.github.comOr use GNOME Extensions app to enable it.
The extension runs a Python script (get-usage.py) that:
- Launches Claude Code CLI with the
/usagecommand - Parses the usage information
- Returns formatted JSON data
- Updates the panel display
The extension displays:
- Panel Icon: Shows usage status with emoji indicators
- Percentage: Current weekly usage percentage
- Session Usage: Tokens used in current session with reset time
- Weekly Usage: Tokens used this week with reset date
The extension auto-refreshes every 5 minutes (300 seconds). To modify this:
Edit extension.js:203 and change the timeout value:
this._timeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 300, () => {- Check that Claude Code CLI is installed:
which claude - Verify Python 3 is available:
python3 --version - Ensure pexpect is installed:
pip show pexpect - Check extension logs:
journalctl -f -o cat /usr/bin/gnome-shell
The script uses --dangerously-skip-permissions to avoid interactive prompts. Ensure your Claude Code setup allows this.
Test the Python script directly:
python3 ~/.local/share/gnome-shell/extensions/claude-usage-checker@DiogoValdrez.github.com/get-usage.pyextension.js: Main extension code (GNOME Shell integration)get-usage.py: Python script that fetches usage from Claude CLImetadata.json: Extension metadatastylesheet.css: Custom styles for the panel widget
View real-time logs:
journalctl -f -o cat /usr/bin/gnome-shell | grep -i claudeAfter modifying the extension, restart GNOME Shell to see changes.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Built for the Claude Code CLI by Anthropic
- Uses GNOME Shell Extension APIs
- Python pexpect library for CLI interaction