Add initial code

This commit is contained in:
Quantum 2021-09-06 21:42:22 -04:00
parent 2115375924
commit f8873f6bdf
2 changed files with 42 additions and 0 deletions

10
record-screen Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
if ! pkill -INT -P "$(pgrep -xo record-screen)" wf-recorder 2>/dev/null; then
geometry="$(slurp -d)"
if [ -n "$geometry" ]; then
pkill -USR1 -x record-screend
mkdir -p ~/Videos/Recordings
wf-recorder -f ~/Videos/Recordings/"screen-record-$(date +%Y-%m-%d-%H-%M-%S).mp4" -g "$geometry"
pkill -USR2 -x record-screend
fi
fi

32
record-screend Executable file
View file

@ -0,0 +1,32 @@
#!/bin/bash
recordings=0
update() {
if [ "$recordings" -gt 0 ]; then
echo " Recording"
else
echo
fi
}
begin_record() {
recordings=$((recordings + 1))
update
}
end_record() {
recordings=$((recordings - 1))
update
}
exec sleep infinity &
pid="$!"
trap begin_record SIGUSR1
trap end_record SIGUSR2
trap "kill $pid" EXIT
while :; do
wait "$pid"
done