tys-better-waybar-modules
v1.0.0
Published
TypeScript waybar modules for network, clock, memory, and disk monitoring
Downloads
5
Maintainers
Readme
Waybar Modules
TypeScript-based waybar modules for network, clock, memory, and disk monitoring with VPN detection and state-based color coding.
Features
- Network: Toggle between local/public IP, VPN indicator, WiFi signal strength
- Clock: 3-state toggle (local time → date → UTC time)
- Memory: Color-coded memory usage (green >30%, yellow 10-30%, red <10% free)
- Disk: Color-coded disk usage (green >30%, yellow 10-30%, red <10% free)
Installation
npm install -g waybar-modulesUsage
Waybar Configuration
Update your ~/.config/waybar/config.jsonc:
{
"modules-right": [
"custom/network",
"custom/clock",
"custom/memory",
"custom/disk"
],
"custom/network": {
"format": "{}",
"exec": "waybar-network",
"on-click": "waybar-network toggle",
"interval": 10,
"return-type": "json"
},
"custom/clock": {
"format": "{}",
"exec": "waybar-clock",
"on-click": "waybar-clock toggle",
"interval": 60
},
"custom/memory": {
"format": "{}",
"exec": "waybar-memory",
"interval": 10,
"return-type": "json"
},
"custom/disk": {
"format": "{}",
"exec": "waybar-disk",
"interval": 30,
"return-type": "json"
}
}CSS Styling
Add to ~/.config/waybar/style.css:
#custom-network,
#custom-clock,
#custom-memory,
#custom-disk {
padding: 0px 10px;
margin: 0px 1px;
}
/* Memory states */
#custom-memory.low { color: #50fa7b; }
#custom-memory.medium { color: #f1fa8c; }
#custom-memory.high { color: #ff5555; }
/* Disk states */
#custom-disk.low { color: #50fa7b; }
#custom-disk.medium { color: #f1fa8c; }
#custom-disk.high { color: #ff5555; }
/* Network states */
#custom-network.disconnected { color: #ff5555; }Commands
# Network (shows local IP by default)
waybar-network
# Toggle between local and public IP
waybar-network toggle
# Clock (cycles through 3 formats on click)
waybar-clock
# Memory usage
waybar-memory
# Disk usage
waybar-diskRequirements
- Node.js >= 16.0.0
- Linux with
iwcommand (for WiFi) ipcommand (for network info)curl(for public IP)
API
import { network, clock, memory, disk } from 'waybar-modules';
// Use programmatically
network(['toggle']);
clock([]);
memory();
disk();License
MIT
