You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
685 B
Bash
47 lines
685 B
Bash
#!/bin/sh
|
|
|
|
record_both() {
|
|
ffmpeg -y \
|
|
-f x11grab \
|
|
-s 1280x720 \
|
|
-i :0.0 \
|
|
-f alsa -i default \
|
|
"$HOME/recordings/out-$(date '+%m%d-%H%M').mkv" &
|
|
echo $! > /tmp/recordingpid
|
|
echo "[rec]" > $HOME/x
|
|
}
|
|
|
|
end_recording() { \
|
|
recpid="$(cat /tmp/recordingpid)"
|
|
kill -15 "$recpid"
|
|
echo "[]" > $HOME/x
|
|
rm -f /tmp/recordingpid
|
|
sleep 3
|
|
kill -9 "$recpid"
|
|
exit
|
|
}
|
|
|
|
select_recording_type() {
|
|
recording=$(printf "both\nvideo\naudio\nend" | dmenu -i -p "What do:")
|
|
|
|
case "$recording" in
|
|
"both")
|
|
record_both;;
|
|
"video")
|
|
;;
|
|
"audio")
|
|
;;
|
|
"end")
|
|
end_recording;;
|
|
esac
|
|
}
|
|
|
|
case "$1" in
|
|
"both")
|
|
record_both;;
|
|
"end")
|
|
end_recording;;
|
|
*)
|
|
select_recording_type;;
|
|
esac
|