This commit is contained in:
sankalp committed 2023-04-24 15:41:27 +05:45
1 parent 0b17aa140b
commit dde4ef218a
136 files changed
+9796

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
if [ "$1" = "status" ]; then
state=$(amixer sget Capture | grep "\[on\]")
if [ -n "$state" ]; then
echo "no"
else
echo "yes"
fi
elif [ "$1" = "toggle" ]; then
state=$(amixer sget Capture | grep "\[on\]")
if [ -n "$state" ]; then
amixer sset Capture nocap
echo "no"
else
amixer sset Capture cap
echo "yes"
fi
elif [ "$1" = "set" ] && [ "$2" -gt 0 ] && [ "$2" -le 100 ]; then
volume="$2%"
amixer sset Capture "${volume}"
echo "Volume set to ${volume}"
elif [ "$1" = "get" ]; then
(( mic_vol = $(amixer sget Capture | grep -oE '[0-9]+%' | tr -d '%') * 100 / 100 ))
echo $mic_vol
elif [ "$1" = "percent" ] && [ "$2" -gt 0 ] && [ "$2" -le 100 ]; then
amixer sset Capture "${2}%"
echo "Volume set to ${2}%"
else
echo "Usage: $0 [status|toggle|set|get|percent]"
fi