Files
omarchy/bin/omarchy-cmd-screenrecord

29 lines
828 B
Plaintext
Raw Normal View History

#!/bin/bash
# Set recorder based on GPU
OUTPUT_DIR="${OMARCHY_SCREENRECORD_DIR:-$HOME/Videos}"
2025-07-19 17:02:52 -05:00
screenrecording() {
filename="$OUTPUT_DIR/screenrecording-$(date +'%Y-%m-%d_%H-%M-%S').mp4"
2025-07-19 22:43:28 -05:00
notify-send "Screen recording starting..." -t 1000
sleep 1
2025-07-22 08:58:20 -05:00
if lspci | grep -qi 'nvidia'; then
wf-recorder -f "$filename" -c libx264 -p crf=23 -p preset=medium -p movflags=+faststart "$@"
else
wl-screenrec -f "$filename" --ffmpeg-encoder-options="-c:v libx264 -crf 23 -preset medium -movflags +faststart" "$@"
fi
2025-07-19 17:02:52 -05:00
}
2025-07-22 08:58:20 -05:00
if pgrep -x wl-screenrec >/dev/null || pgrep -x wf-recorder >/dev/null; then
pkill -x wl-screenrec
pkill -x wf-recorder
notify-send "Screen recording saved to ~/Videos" -t 2000
2025-07-19 22:43:28 -05:00
elif [[ "$1" == "output" ]]; then
screenrecording
else
region=$(slurp) || exit 1
2025-07-19 17:02:52 -05:00
screenrecording -g "$region"
fi