commit 83302f20e4294641c037d44381864a189419dc3b parent 5b7f238a7b056b6b783c33e740cdfae1e22b40c2 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Wed, 4 Nov 2020 15:19:31 +0100 screenrecord: limit screen resolution and show elapsed time in statusbar Diffstat:
M | .local/bin/screenrecord | | | 23 | ++++++++++++++++++++++- |
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/.local/bin/screenrecord b/.local/bin/screenrecord @@ -1,9 +1,23 @@ #!/bin/sh lockfile=/tmp/screenrecord.pid +screen=eDP-1 startrecording() { + + fname="screenrecord-$(date '+%Y-%m-%d_%H:%M:%S')" + out="$HOME/tmp/${fname}.mkv" + sndioctl -q input.level=1.0 - out="$HOME/tmp/screenrecord-$(date '+%Y-%m-%d_%H:%M:%S').mkv" + + if test "$(xdpyinfo | awk '/dimensions/ {sub(/x.*/, "", $2); print $2}')" -gt 2000; then + xrandr --output "$screen" --mode 1920x1080 + fi + + if command -v stopwatch >/dev/null 2>&1; then + pkill spoon + nohup stopwatch -x >/dev/null 2>&1 & + fi + ffmpeg -y \ -f x11grab \ -framerate 60 \ @@ -29,6 +43,13 @@ stoprecording() { kill "$(cat "$lockfile")" rm -f "$lockfile" #notify "${0##*/}" 'recording ended' + + if ! pgrep spoon; then + pkill stopwatch + nohup spoon >/dev/null 2>&1 & + fi + + xrandr --output "$screen" --auto } if [ -f "$lockfile" ]; then