Skip to content

erffy/zig-waybar-contrib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Important

This project is in active development. As I'm learning Zig, updates may take time. Your contributions, feedback, and patience are greatly appreciated! 🚀

zig-waybar-contrib

High-performance Waybar modules written in Zig for efficient system monitoring

License: GPL v3 Zig Waybar

Overview

zig-waybar-contrib is a collection of lightweight, blazingly fast Waybar modules built with Zig. These modules are designed to provide accurate system monitoring with minimal resource usage, taking advantage of Zig's performance characteristics and memory safety.

Why Zig?

  • Zero-cost abstractions - Runtime performance without sacrificing code clarity
  • Compile-time safety - Catch errors before they reach production
  • Small binaries - Minimal overhead for system monitoring
  • Fast compilation - Quick iteration during development

Features

  • Ultra-fast execution - Optimized with ReleaseFast + LTO + LLVM
  • 🔒 Memory safe - No buffer overflows or memory leaks
  • 🧩 Modular design - Include only what you need
  • 📊 Real-time data - Accurate, up-to-date system metrics
  • 🎯 Waybar native - JSON output format, seamless integration
  • 🪶 Lightweight - Minimal system dependencies

Available Modules

All modules output single-line JSON compatible with Waybar's custom module interface.

Module Description Status Dependencies Platforms Signal
Updates System package update tracker ✅ Ready fakeroot Arch Linux 2
GPU GPU usage, temperature, memory ✅ Ready None AMD RX Series 5
Memory RAM usage and statistics ✅ Ready None Linux 4
Ping Network latency monitoring ✅ Ready None Linux None
Network Network speed monitoring ⚠️ Partially Linux 3

Screenshots

Updates

Updates Available No Updates

GPU

GPU Module

Memory

Memory Module

Ping

Ping Module

Installation

Quick Install (Recommended)

  • Note: This project will be packaged for Pacman and submitted to the AUR in a future releases.

Download pre-compiled binaries from GitHub Releases:

Build from Source

Requirements:

  • Zig: 0.14.0+
  • Git
# Clone the repository
git clone https://github.com/erffy/zig-waybar-contrib.git && cd zig-waybar-contrib

# Build all modules
zig build

# Install to system
sudo cp zig-out/bin/* /usr/local/bin/

Configuration

Basic Waybar Setup

Add to your Waybar configuration (~/.config/waybar/config.jsonc):

{
  "modules-right": [
    "custom/updates",
    "custom/gpu", 
    "custom/memory",
    "custom/ping",
    "custom/network"
  ],
  
  "custom/updates": {
    "exec": "/usr/local/bin/updates-module",
    "return-type": "json",
    "interval": 0,
    "signal": 2,
    "escape": true
  },
  
  "custom/gpu": {
    "exec": "/usr/local/bin/gpu-module",
    "return-type": "json", 
    "interval": 0,
    "signal": 5,
  },
  
  "custom/memory": {
    "exec": "/usr/local/bin/memory-module",
    "return-type": "json",
    "interval": 0,
    "signal": 4, 
  },
  
  "custom/ping": {
    "exec": "/usr/local/bin/ping-module",
    "return-type": "json",
    "interval": 1
  },

  // ⚠️ Partially implemented, unexpected behavior may occur.
  "custom/network": {
    "exec": "/usr/local/bin/network-module",
    "return-type": "json",
    "interval": 0,
    "signal": 3
  }
}

Development

Project Structure

zig-waybar-contrib/
├── src/
│   ├── updates.zig    # Updates module
│   ├── gpu.zig        # GPU module  
│   ├── memory.zig     # Memory module
│   ├── network.zig    # Network module
│   └── ping.zig       # Ping module
├── build.zig          # Build configuration
└── assets/            # Screenshots

Contributing

Contributions are welcome! Here's how you can help:

Code Contributions

  • 🐛 Bug Fixes - Help squash issues
  • Performance Improvements - Make modules even faster
  • 🧩 New Modules - Add support for more system metrics
  • 🎨 Code Quality - Improve readability and maintainability

Other Ways to Help

  • 📖 Documentation - Improve guides and examples
  • 🧪 Testing - Report bugs and compatibility issues
  • 💡 Feature Requests - Suggest new modules or improvements
  • 🎨 Themes - Share your Waybar styling configs

Development Workflow

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-module
  3. Make your changes and test thoroughly
  4. Follow Zig style conventions: zig fmt src/
  5. Add tests if applicable
  6. Submit a pull request with a clear description

Roadmap

  • Implement Environment-based configuration
  • Implement Network speed monitoring

License

This project is licensed under the GNU General Public License v3.0. See LICENSE for details.

Acknowledgments

  • Zig Team - For creating an amazing systems programming language
  • Waybar Contributors - For the excellent status bar that makes this possible
  • Community - For feedback, bug reports, and contributions

Made with ❤️ by Me

Star ⭐ this repo if you find it useful!