From e123495f646ac21558251f701f00a801dccd4c37 Mon Sep 17 00:00:00 2001 From: xnm Date: Fri, 15 Mar 2024 21:25:03 +0200 Subject: [PATCH] added microphone & webcam indicators to `waybar` --- home/.config/fish/functions/check_webcam.fish | 5 +++++ home/.config/waybar/config | 15 +++++++++++++++ home/.config/waybar/style.css | 10 ++++++++++ nixos/terminal-utils.nix | 1 + 4 files changed, 31 insertions(+) create mode 100644 home/.config/fish/functions/check_webcam.fish diff --git a/home/.config/fish/functions/check_webcam.fish b/home/.config/fish/functions/check_webcam.fish new file mode 100644 index 0000000..d3d63d6 --- /dev/null +++ b/home/.config/fish/functions/check_webcam.fish @@ -0,0 +1,5 @@ +function check_webcam + if test (lsof /dev/video0 | count) -gt 3 + echo "{\"text\":\"󰖠\", \"tooltip\":\"webcam is used\", \"alt\":\"Webcam\"}" + end +end diff --git a/home/.config/waybar/config b/home/.config/waybar/config index b25fc14..b75fcad 100644 --- a/home/.config/waybar/config +++ b/home/.config/waybar/config @@ -164,6 +164,8 @@ "group/misc": { "orientation": "horizontal", "modules": [ + "pulseaudio#microphone_indicator", + "custom/webcam", "custom/recording", "custom/geo", "custom/media", @@ -174,6 +176,19 @@ ], }, + "pulseaudio#microphone_indicator": { + "format": "{format_source}", + "format-source": "󰍬", + "format-source-muted": "", + "tooltip-format": "microphone on", + }, + + "custom/webcam": { + "interval": 1, + "exec": "fish -c check_webcam", + "return-type": "json", + }, + "custom/recording": { "interval": 1, "exec-if": "pgrep wf-recorder", diff --git a/home/.config/waybar/style.css b/home/.config/waybar/style.css index 1203ff8..904d3a3 100644 --- a/home/.config/waybar/style.css +++ b/home/.config/waybar/style.css @@ -208,6 +208,16 @@ window.top_bar .modules-center { color: @subtext0; } +#pulseaudio.microphone_indicator { + color: @pink; + margin-right: 4; +} + +#custom-webcam { + color: @maroon; + margin-right: 4; +} + #custom-recording { color: @red; margin-right: 4; diff --git a/nixos/terminal-utils.nix b/nixos/terminal-utils.nix index e601155..dc9049d 100644 --- a/nixos/terminal-utils.nix +++ b/nixos/terminal-utils.nix @@ -40,6 +40,7 @@ mdcat pandoc lsd + lsof gping viu tre-command