xxwhirlpool
·
2026-03-18
recordscreen
1#!/usr/bin/env bash
2#
3# inspired by bread on penguins
4#
5# https://github.com/BreadOnPenguins/scripts/blob/master/record
6
7VIDPATH="/home/kat/Videos/Screencasts"
8
9record() {
10 ffmpeg -s "$(xdpyinfo | awk '/dimensions/{print $2}')" -f x11grab -r 30 -i :0.0 -c:v h264 -qp 0 "$VIDPATH/screencast_ffmpeg_$(date '+%a__%b%d__%H_%M_%S').mp4" &
11 echo $! > /tmp/recpid
12
13 notify-send "screen recording started"
14}
15
16end() {
17 if [ ! -z $(cat /tmp/recpid) > /dev/null ]; then
18 kill -15 "$(cat /tmp/recpid)" && rm -f /tmp/recpid
19 notify-send "screen recording ended"
20 fi
21}
22
23cmd=$(printf "start\nend\n" | dmenu -i -c -l 2 -p "screen rec")
24
25if [[ -z "$cmd" ]]; then
26 exit 0
27fi
28
29case "$cmd" in
30 start) record;;
31 end) end;;
32esac