- Rust 75.4%
- Nix 24.6%
| resources | ||
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
Waybar Privacy Monitor
A lightweight privacy monitor for Waybar that tracks the status of your microphone, camera, and screen recording/sharing.
Warning
This is only tested on my system with the following:
- Display Server: Wayland (Hyprland)
- Audio Server: PipeWire (with
pipewire-pulse)- Status Bar: Waybar
It relies on specific tools like
pactlandpw-linkand scanning/procfile descriptors. It may not work out-of-the-box on other configurations (e.g., X11, pure PulseAudio, etc.).
How it Works
The monitor runs in the background and:
- Watches PulseAudio (via
pactl) for Microphone usage. - Scans active processes for open
/dev/video*file descriptors to detect webcam usage. - Checks PipeWire links (via
pw-link) for screen sharing active streams.
When a change is detected, it writes a JSON status to /tmp/waybar-privacy-monitor-status.json and signals Waybar to update.
Installation & Usage
1. Run the Monitor
You need to ensure the binary is running in the background of your session.
If you are using NixOS with Hyprland, you can add it to your flake inputs and run it from your exec-once list.
# flake.nix:
{
inputs.waybar-privacy-monitor.url = "github:akotro/waybar-privacy-monitor";
}
# hyprland.nix:
exec-once = [
"${inputs.waybar-privacy-monitor.packages.${pkgs.system}.default}/bin/bar-privacy-monitor"
];
Or manually run it:
./bar-privacy-monitor &
2. Configure Waybar
Add the following module configuration to your waybar config (usually ~/.config/waybar/config).
"custom/privacy": {
"exec": "cat /tmp/waybar-privacy-monitor-status.json",
"interval": "once",
"return-type": "json",
"format": "{}",
"tooltip": true,
"signal": 8
}
Ensure you add "custom/privacy" to your modules list (e.g., "modules-right").
You can optionally add some css as well in style.css (usually ~/.config/waybar/style.css).
#custom-privacy {
margin: 0 4px;
}
Configuration
The tool uses a configuration file located at ~/.config/waybar-privacy-monitor/config.toml. If it doesn't exist, it will be created with default values.
status_file = "/tmp/waybar-privacy-monitor-status.json"
waybar_signal = 8
[mic]
icon = ""
color = "#ff6a00"
[cam]
icon = ""
color = "#42be65"
[screen]
icon = ""
color = "#ee5396"