From 4c5021e8af8f8b93c517949900e14f1d421d3f8e Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:28 +0100 Subject: feat(waybar): add webcam privacy indicator V4L2 capture goes directly through /dev/videoN and never traverses the PipeWire portal, so the built-in privacy module misses it. New custom/webcam module polls fuser on /dev/video* every 2s and shows a red 'CAM' badge when any device is held open. Empty text when idle, so the slot collapses and stays out of the way when the webcam is unused (i.e. always, on a usual day). --- dot_config/waybar/executable_webcam-status.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 dot_config/waybar/executable_webcam-status.sh (limited to 'dot_config/waybar/executable_webcam-status.sh') diff --git a/dot_config/waybar/executable_webcam-status.sh b/dot_config/waybar/executable_webcam-status.sh new file mode 100644 index 0000000..b8e5570 --- /dev/null +++ b/dot_config/waybar/executable_webcam-status.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# Emit waybar JSON when any /dev/video* device is held open by a process. +# V4L2 capture (firefox, zoom, OBS, etc.) doesn't go through PipeWire's +# privacy portal, so the built-in waybar privacy module never sees it. +set -eu + +devs=$(echo /dev/video[0-9]*) +case "$devs" in + '/dev/video[0-9]*') exit 0 ;; # no devices present +esac + +# fuser exits 0 when at least one device has an opener, 1 otherwise. Stderr +# carries 'PID' for each match; redirect it away. +if fuser $devs >/dev/null 2>&1; then + printf '{"text":"CAM","tooltip":"webcam in use","class":"active","alt":"active"}\n' +else + printf '{"text":"","alt":"idle"}\n' +fi -- cgit v1.3.1