Skip to content

1jehuang/niri-workspaces-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

niri-workspaces-rs

A fast, event-driven workspace indicator for Waybar and niri.

Features

  • Visual bars instead of numbers - each window is a colored bar
  • Color-coded by app - Chrome (Google colors), Discord (purple), Firefox (orange), nvim (green), Claude (orange), Codex (cyan)
  • Terminal app detection - detects Claude/Codex/nvim running inside terminals via /proc
  • Focused window indicator - █ for focused, ▌ for would-be-focused, | for others
  • Dimmed unfocused workspaces - colors are dimmed when workspace isn't focused
  • Daemon mode - persistent socket connection, no process spawning

Benchmarks

Metric Value
Memory 2.5 MB RSS
CPU per update ~1.1ms
80 rapid switches ~90ms total CPU

Comparison

Approach CPU per update
Bash script ~340ms
Rust + signal ~12-14ms
Rust daemon ~1.1ms

The daemon is ~10-12x faster than the signal-based approach and ~300x faster than the original bash script.

Installation

cargo build --release
cp target/release/niri-workspaces ~/.config/waybar/

Waybar Configuration

"custom/workspaces": {
    "exec": "/home/user/.config/waybar/niri-workspaces",
    "return-type": "json",
    "format": "{}"
}

No interval or signal needed - the daemon outputs JSON whenever workspace/window events occur.

License

MIT

About

Fast Rust waybar module for niri workspace visualization with app-colored window indicators

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages