From 0599466e2cf32b84ad482d2af85646a76b3108e7 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Mon, 14 Feb 2022 20:17:20 +0100 Subject: [PATCH] add i3bar indicator for microphone status --- .config/i3/config | 2 +- .config/i3pystatus/config.py | 6 ++++++ .config/i3pystatus/microphone-status.sh | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 .config/i3pystatus/microphone-status.sh diff --git a/.config/i3/config b/.config/i3/config index a9aa9ac..66f0cab 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -132,7 +132,7 @@ bindsym $mod+Next exec pactl set-sink-volume @DEFAULT_SINK@ -2%; exec pactl set- bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +2%; exec pactl set-sink-mute @DEFAULT_SINK@ 0 bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -2%; exec pactl set-sink-mute @DEFAULT_SINK@ 0 bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle -bindsym XF86AudioMicMute exec pactl set-source-mute alsa_input.pci-0000_00_1f.3.analog-stereo toggle +bindsym XF86AudioMicMute exec pactl set-source-mute alsa_input.pci-0000_07_00.6.HiFi__hw_acp__source toggle bindsym XF86MonBrightnessUp exec sudo light -A 5 bindsym XF86MonBrightnessDown exec sudo light -U 5 diff --git a/.config/i3pystatus/config.py b/.config/i3pystatus/config.py index 85a8e2b..29efc14 100644 --- a/.config/i3pystatus/config.py +++ b/.config/i3pystatus/config.py @@ -14,6 +14,12 @@ status.register("pulseaudio", format_muted="♪D -∞dB", step="2", sink="@DEFAULT_SINK@") +status.register("shell", + format="{output}", + hints = {"markup": "pango"}, + command="/home/kunsi/.config/i3pystatus/microphone-status.sh", + on_rightclick="pactl set-source-mute alsa_input.pci-0000_07_00.6.HiFi__hw_acp__source toggle", + interval=1) status.register("backlight", format="{percentage}%", diff --git a/.config/i3pystatus/microphone-status.sh b/.config/i3pystatus/microphone-status.sh new file mode 100755 index 0000000..deae5ae --- /dev/null +++ b/.config/i3pystatus/microphone-status.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +OUT="$(pactl get-source-mute alsa_input.pci-0000_07_00.6.HiFi__hw_acp__source | cut -d' ' -f2)" + +if [ "$OUT" = "yes" ] +then + echo 'M' +else + echo 'Microphone unmuted' +fi