https://github.com/erffy/zig-waybar-contrib
โจ Lightweight Waybar modules built with Zig
https://github.com/erffy/zig-waybar-contrib
sway waybar waybar-contrib waybar-module zig ziglang zls
Last synced: 10 months ago
JSON representation
โจ Lightweight Waybar modules built with Zig
- Host: GitHub
- URL: https://github.com/erffy/zig-waybar-contrib
- Owner: erffy
- License: gpl-3.0
- Created: 2025-01-12T17:08:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-15T20:47:20.000Z (11 months ago)
- Last Synced: 2025-07-16T06:30:01.956Z (11 months ago)
- Topics: sway, waybar, waybar-contrib, waybar-module, zig, ziglang, zls
- Language: Zig
- Homepage:
- Size: 246 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> [!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**
[](https://gnu.org/licenses/gpl-3.0)
[](https://ziglang.org/)
[](https://github.com/Alexays/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 | 10 |
| **GPU** | GPU usage, temperature, memory | โ
Ready | `rocm-smi-lib`, `amdsmi` or `cuda` | AMD RX Series, NVIDIA | 11 |
| **Memory** | RAM usage and statistics | โ
Ready | None | Linux | 12 |
| **Ping** | Network latency monitoring | โ
Ready | None | Linux | 13 |
### Screenshots
#### Updates

#### GPU

#### Memory

#### Ping

## Installation
### Quick Installation
#### [From AUR (Recommended)](https://aur.archlinux.org/packages/zig-waybar-contrib)
You can easily install the latest version of **zig-waybar-contrib** from the Arch User Repository (AUR).
This package provides pre-built binaries as `waybar-module-X-bin`.
Use your preferred AUR helper:
```bash
# Using paru
paru -S zig-waybar-contrib
# Using yay
yay -S zig-waybar-contrib
```
### Build from Source
**Requirements:**
- Zig: 0.14.0+
- Git
- rocm-smi-lib, amdsmi or cuda (for gpu module, optional)
```bash
# 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`):
```jsonc
{
// Load default module configurations from zig-waybar-contrib
"include": [
"/etc/zig-waybar-contrib/config.jsonc"
],
// Display these modules on the right side of the Waybar
"modules-right": [
"custom/updates#zwc",
"custom/gpu#zwc",
"custom/memory#zwc",
"custom/ping#zwc"
],
// ๐ ๏ธ Custom modules configuration
"custom/updates#zwc": {
"exec": "/usr/bin/waybar-module-updates-bin",
"return-type": "json",
"interval": 0,
"signal": 10,
"escape": true
},
"custom/gpu#zwc": {
"exec": "/usr/bin/waybar-module-gpu-bin",
"return-type": "json",
"interval": 0,
"signal": 11
},
"custom/memory#zwc": {
"exec": "/usr/bin/waybar-module-memory-bin",
"return-type": "json",
"interval": 0,
"signal": 12
},
"custom/ping#zwc": {
"exec": "/usr/bin/waybar-module-ping-bin",
"return-type": "json",
"interval": 0,
"signal": 13
}
}
```
### Development
#### Project Structure
```
zig-waybar-contrib/
โ
โโโ README.md # Project overview, installation, and usage instructions
โโโ CHANGELOG.md # Version history with detailed changes per release
โโโ LICENSE # Project license (GPL-3.0-only)
โโโ config.waybar.jsonc # Example Waybar module configuration (JSONC format)
โโโ .gitignore # Git exclusions for build artifacts, cache files, etc.
โ
โโโ build.zig # Zig build script for compiling all modules
โโโ build.zig.zon # Zig package and dependency declaration (Zon format)
โ
โโโ tests/ # Test files
โ
โโโ src/ # Source code
โ โ
โ โโโ utils/ # Shared utility modules
โ โ โโโ mod.zig # Module loader and common interfaces
โ โ โโโ waybar.zig # Waybar signal sender (e.g., USR1/USR2 signaling)
โ โ โโโ format.zig # Byte/usage formatting helpers (e.g., human-readable memory)
โ โ
โ โโโ gpu/ # GPU statistics and backend integration
โ โ โโโ gpu.zig # Unified GPU module (auto-selects backend at compile time)
โ โ โโโ backend/ # Individual backend implementations
โ โ โโโ amdsmi.zig # AMD SMI interface (ROCm 5.x+)
โ โ โโโ rocmsmi.zig # Legacy ROCm SMI interface
โ โ โโโ nvml.zig # NVIDIA GPU interface (via NVML/CUDA)
โ โ
โ โโโ memory.zig # Module for tracking and displaying memory usage
โ โโโ ping.zig # Module for displaying ping/latency to a target host
โ โโโ updates.zig # Module for checking for system/package updates
โ
โโโ assets/ # Images, screenshots, and other media assets
```
### 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 configuration support
### License
This project is licensed under the **GNU General Public License v3.0**. See [LICENSE](./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!*