librem5-goodies/l5-screen-recorder

41 lines
871 B
Bash
Executable File

#!/bin/bash
# GPL3
function usage()
{
echo "Usage: Just press the Screen Shot Icon in the app tray"
exit 0
}
NOTIFY_SEND="notify-send -i emblem-videos-symbolic"
case "$1" in
--help|-h|-?)
usage
;;
esac
VIDEO="$(xdg-user-dir VIDEOS)/$(date +%Y-%m-%d-%H%M%S).avi"
yad --title ScreenCapture --text "A simple GUI to record the screen" --button="Start capture:100" --button="Quit:0" --buttons-layout=center
start_window_return=$?
if [[ $start_window_return -eq 100 ]]
then
wf-recorder -a -f "$VIDEO" --codec=asv1 &
else
exit
fi
yad --title ScreenCapture --text "Screen capture is actively running. \\nFile: $VIDEO" --button='Stop capture:100' --buttons-layout=center
exit_window_return=$?
if [[ $exit_window_return -eq 100 ]]
then
killall -2 wf-recorder
fi
if test -f "$VIDEO"
then
$NOTIFY_SEND ScreenCapture "Video stored at $VIDEO"
fi