i3: Add microphone management to i3bar
This commit is contained in:
@@ -19,7 +19,8 @@ general {
|
||||
}
|
||||
|
||||
|
||||
order += volume_status
|
||||
order += "volume_status output"
|
||||
order += "volume_status input"
|
||||
order += spotify
|
||||
order += "wifi"
|
||||
order += "external_script presentation_mode"
|
||||
@@ -73,7 +74,7 @@ online_status {
|
||||
format = " {icon} "
|
||||
}
|
||||
|
||||
volume_status {
|
||||
volume_status output {
|
||||
cache_timeout = 10
|
||||
format = " {percentage}% "
|
||||
format_muted = " mute "
|
||||
@@ -81,3 +82,13 @@ volume_status {
|
||||
command = "pactl"
|
||||
color_muted = '#FFFFFF'
|
||||
}
|
||||
|
||||
volume_status input {
|
||||
cache_timeout = 10
|
||||
format = " active "
|
||||
format_muted = " mute "
|
||||
thresholds = [(0, 'good'), (1, 'bad')]
|
||||
command = "pactl"
|
||||
color_muted = '#FFFFFF'
|
||||
is_input = True
|
||||
}
|
||||
|
||||
@@ -3,10 +3,15 @@
|
||||
# name of the sink. execute pactl list sinks to get a list
|
||||
SINKNAME="$(pactl info | grep '^Default Sink:' | cut -d ' ' -f 3-)"
|
||||
|
||||
# name of the sink. execute pactl list sinks to get a list
|
||||
SOURCENAME="$(pactl info | grep '^Default Source:' | cut -d ' ' -f 3-)"
|
||||
|
||||
#SINKNAME="alsa_output.usb-Logitech_Logitech_Wireless_Headset_88C626354D45-00.analog-stereo"
|
||||
# this is the worst
|
||||
SINK=$(( $(pactl list sinks | grep "Name: " | grep -n "${SINKNAME}"$ | grep -o "^[[:digit:]]*") -1))
|
||||
|
||||
SOURCE=$(( $(pactl list sources | grep "Name: " | grep -n "${SOURCENAME}"$ | grep -o "^[[:digit:]]*") -1))
|
||||
|
||||
|
||||
getvol() {
|
||||
echo $(pactl list sinks | grep "^[[:space:]]*Volume" | head -n $(( $SINK + 1 )) | tail -n 1 | grep -o "[[:digit:]]*%" | head -n 1 | cut -d "%" -f 1)
|
||||
@@ -62,6 +67,10 @@ mute-toggle() {
|
||||
pactl set-sink-mute $SINKNAME toggle
|
||||
}
|
||||
|
||||
mute-toggle-mic() {
|
||||
pactl set-source-mute $SOURCENAME toggle
|
||||
}
|
||||
|
||||
status() {
|
||||
if [[ $(ismuted) == "1" ]] ; then
|
||||
echo "mute"
|
||||
@@ -77,8 +86,12 @@ usage() {
|
||||
echo "$0 set-vol VOL_PERC"
|
||||
}
|
||||
|
||||
update_status_bar() {
|
||||
~/.i3/scripts/bar-update volume_status
|
||||
update_status_bar_sink() {
|
||||
~/.i3/scripts/bar-update "volume_status output"
|
||||
}
|
||||
|
||||
update_status_bar_source() {
|
||||
~/.i3/scripts/bar-update "volume_status input"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@@ -95,19 +108,23 @@ case "$1" in
|
||||
else
|
||||
setvol "$2"
|
||||
fi
|
||||
update_status_bar
|
||||
update_status_bar_sink
|
||||
;;
|
||||
"mute")
|
||||
mute
|
||||
update_status_bar
|
||||
update_status_bar_sink
|
||||
;;
|
||||
"unmute")
|
||||
unmute
|
||||
update_status_bar
|
||||
update_status_bar_sink
|
||||
;;
|
||||
"mute-toggle")
|
||||
mute-toggle
|
||||
update_status_bar
|
||||
update_status_bar_sink
|
||||
;;
|
||||
"mute-toggle-mic")
|
||||
mute-toggle-mic
|
||||
update_status_bar_source
|
||||
;;
|
||||
"is-muted")
|
||||
echo $(ismuted)
|
||||
|
||||
Reference in New Issue
Block a user