aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-24 19:34:24 -0300
committerEuAndreh <eu@euandre.org>2023-03-24 19:34:24 -0300
commitfc4bd01a3b4f82a2d29b2c097753d816e57cbfcc (patch)
tree115943bde17a316c5558d2c66f7a2329a273a071 /bin
parentetc/guix/home.scm: Include mpv besides vlc (diff)
downloaddotfiles-fc4bd01a3b4f82a2d29b2c097753d816e57cbfcc.tar.gz
dotfiles-fc4bd01a3b4f82a2d29b2c097753d816e57cbfcc.tar.xz
bin/record-my-screen: Add working utility
Diffstat (limited to 'bin')
-rwxr-xr-xbin/record-my-screen74
1 files changed, 74 insertions, 0 deletions
diff --git a/bin/record-my-screen b/bin/record-my-screen
new file mode 100755
index 0000000..8b8a525
--- /dev/null
+++ b/bin/record-my-screen
@@ -0,0 +1,74 @@
+#!/bin/sh
+set -eu
+
+usage() {
+ cat <<-'EOF'
+ record-my-screen [FILE]
+ record-my-screen -h
+ EOF
+}
+
+help() {
+ cat <<-'EOF'
+
+
+ Options:
+ -h, --help show this message
+
+ FILE the name of the output file (default: out.webm)
+
+
+ Do a screen capture. Exit with "q".
+
+
+ Examples:
+
+ Just run it:
+
+ $ record-my-screen
+ EOF
+}
+
+
+for flag in "$@"; do
+ case "$flag" in
+ --)
+ break
+ ;;
+ --help)
+ usage
+ help
+ exit
+ ;;
+ *)
+ ;;
+ esac
+done
+
+while getopts 'h' flag; do
+ case "$flag" in
+ h)
+ usage
+ help
+ exit
+ ;;
+ *)
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+FILE="${1:-out.webm}"
+
+
+RESOLUTION="$(xrandr -q --current | awk '/[*]/ && $0=$1')"
+
+ffmpeg \
+ -f pulse \
+ -i default \
+ -f x11grab \
+ -s "$RESOLUTION" \
+ -i "$DISPLAY" \
+ "$FILE"