Skip to content

v0.4.0 - Multi-Monitor Caching

Choose a tag to compare

@NihilDigit NihilDigit released this 26 Jan 11:27
· 69 commits to main since this release

🚀 New Features

File-Based Caching System

Solves the "Net Err" issue on multi-monitor setups where multiple Waybar instances (one per display) make concurrent API requests that get rate-limited.

  • Automatic caching: API responses cached to ~/.cache/waybar-ai-usage/
  • 60-second TTL: Fresh data while avoiding rate limits
  • Concurrent request prevention: Uses .updating marker files to coordinate between instances
  • Shared data: All monitors display the same cached data
  • Zero configuration: Works automatically out of the box

How It Works

Before (v0.3.0):

Monitor 1 Waybar → API request → Rate limited ❌
Monitor 2 Waybar → API request → Rate limited ❌  
Monitor 3 Waybar → API request → Success ✓

After (v0.4.0):

Monitor 1 Waybar → API request → Cache saved → Success ✓
Monitor 2 Waybar → Read cache → Success ✓
Monitor 3 Waybar → Read cache → Success ✓

🔧 Technical Details

  • Cache location: ~/.cache/waybar-ai-usage/claude.json and codex.json
  • Prevents race conditions with temporary marker files
  • Falls back to stale cache if API request fails
  • Works seamlessly with the existing click-to-refresh behavior

🐛 Bug Fixes

  • Fix python-sly dependency in PKGBUILD and .SRCINFO

📝 Full Changelog

feat: add file-based caching to prevent concurrent API requests - ce48e05

  • Add get_cached_or_fetch() function in common.py
  • Implement 60-second TTL caching mechanism
  • Use marker files to prevent concurrent requests
  • Both claude-usage and codex-usage now share cached data

fix: add python-sly dependency - d36a3d0, 9570881

  • Add missing python-sly dependency to PKGBUILD

🔗 Installation

AUR (Arch Linux)

yay -Syu waybar-ai-usage

uv tool

uv tool install git+https://github.com/NihilDigit/waybar-ai-usage@v0.4.0

⚠️ Breaking Changes

None. This release is fully backwards compatible.

📖 Waybar Configuration

The refresh behavior has been improved. To ensure manual refresh clears the cache:

"custom/claude-usage": {
  "exec": "~/.local/bin/claude-usage --waybar",
  "return-type": "json",
  "interval": 120,
  "on-click": "rm -f ~/.cache/waybar-ai-usage/claude.json && pkill -RTMIN+8 waybar",
  "signal": 8
}

See the README for complete configuration examples.