From 80581b2eb5b67006d439b20089ab87976c6e5ffa Mon Sep 17 00:00:00 2001 From: Daniil Tsivinsky Date: Sat, 11 Jun 2022 15:04:11 +0300 Subject: [PATCH] add waybar component for microphone state --- bin/mic-state.sh | 8 ++++++++ config/.config/waybar/config | 11 +++++++++++ config/.config/waybar/style.css | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 bin/mic-state.sh diff --git a/bin/mic-state.sh b/bin/mic-state.sh new file mode 100755 index 0000000..0c270d9 --- /dev/null +++ b/bin/mic-state.sh @@ -0,0 +1,8 @@ +#! /bin/bash + +state=$(pactl get-source-mute $(pactl get-default-source) | awk '{printf $2}') + +result='{"text": "", "alt": "' +result+="$state\"}" + +echo "$result" diff --git a/config/.config/waybar/config b/config/.config/waybar/config index 47abaa4..bf65a8c 100644 --- a/config/.config/waybar/config +++ b/config/.config/waybar/config @@ -7,6 +7,7 @@ "modules-right": [ "tray", "pulseaudio", + "custom/mic-state", "sway/language", "network", "backlight", @@ -26,6 +27,16 @@ "format-muted": "MUTE", "on-click": "pavucontrol" }, + "custom/mic-state": { + "exec": "~/dotfiles/bin/mic-state.sh", + "format": "{icon}", + "return-type": "json", + "restart-interval": 0, + "format-icons": { + "yes": "", + "no": "" + } + }, "sway/language": { "tooltip": false }, diff --git a/config/.config/waybar/style.css b/config/.config/waybar/style.css index 25ab034..7791c3e 100644 --- a/config/.config/waybar/style.css +++ b/config/.config/waybar/style.css @@ -34,12 +34,14 @@ window#waybar { margin-left: 10px; } -#network { +#network, +#custom-mic-state { font-family: "Font Awesome 6 Free Solid"; } #tray, #pulseaudio, +#custom-mic-state, #language, #network, #upower,