Files
omarchy/bin/omarchy-cmd-screenrecord
Andreas Nigg 6d8a1e3bcf wf-recorder instead of wl-screenrec (NVIDIA support for screen recording) (#278)
* use wf-recorder instead of wl-screenrec

wl-screenrec does not support NVIDIA drivers as of now

* install wf-recorder and migration for it

* use wl-screenrec for non-nvidia and wf-recorder otherwise

* useless comment

* only use one of the screen recording features
2025-07-22 08:47:25 -05:00

38 lines
909 B
Bash
Executable File

#!/bin/bash
# Set recorder based on GPU
if lspci | grep -qi 'nvidia'; then
RECORDER="wf-recorder"
RECORDER_ARGS="-c libx264 -p crf=23 -p preset=medium -p movflags=+faststart"
else
RECORDER="wl-screenrec"
RECORDER_ARGS="--ffmpeg-encoder-options=\"-c:v libx264 -crf 23 -preset medium -movflags +faststart\""
fi
screenrecording() {
local filename
filename="$HOME/Videos/screenrecording-$(date +'%Y-%m-%d_%H-%M-%S').mp4"
notify-send "Screen recording starting..." -t 1000
sleep 1
eval "$RECORDER -f \"$filename\" $RECORDER_ARGS \"\$@\""
}
stop_recording() {
if pgrep -x "$RECORDER" >/dev/null; then
pkill -x "$RECORDER"
notify-send "Screen recording saved to ~/Videos" -t 2000
return 0
fi
return 1
}
if stop_recording; then
# Recording was stopped
:
elif [[ "$1" == "output" ]]; then
screenrecording
else
region=$(slurp) || exit 1
screenrecording -g "$region"
fi