From 861e266cf7ac8130c755468e08b588bb29cd5432 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Mon, 14 Dec 2020 00:19:13 +0800 Subject: [PATCH] [misc] set initial microphone volume --- bin/sc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/bin/sc b/bin/sc index 4801188..15da981 100755 --- a/bin/sc +++ b/bin/sc @@ -17,6 +17,8 @@ function _start -a x y w h fps exit 1 end set outfile "$HOME/recording/screencast-"(date '+%y%m%d-%H%M-%S')".mp4" + touch /tmp/recording.pid + sleep 1 ffmpeg \ -f x11grab -s $w'x'$h -i "$DISPLAY+$x,$y" \ -f alsa -i default \ @@ -115,6 +117,8 @@ function desktop -a fps echo 'unable to find geometry of the first monitor' exit 1 end + #micvol 15000 + pacmd set-source-volume noechosource 52000 _start $m[4] $m[5] $m[2] $m[3] $fps end @@ -150,6 +154,26 @@ function cover -a infile text gravity outfile $outfile end +set --append subcmds keep_mic_vol +function keep_mic_vol -a volume + while true + pacmd set-source-volume noechosource $volume + sleep 0.1 + end +end + +set --append subcmds micvol +set micvol_help '' '0~65535' +function micvol -a volume + set kmvpid (ps aux | grep ' keep_mic_vol ' | head -n -1 | awk '{print $2}') + if test -n "$kmvpid" + echo killing $kmvpid + kill $kmvpid + end + set sc (status filename) + $sc keep_mic_vol $volume & +end + set --append subcmds help set help_help '[subcmd]' 'print this menu' function help -a subcmd