Use output display or region geometry to record

The previous code did not identify the output display correctly,
leading to wf-recorder asking the user to select the region when the
user requested the display output to be selected.

With this change the bash script will use slurp with the -o flag to
identify the display output.

This has not been tested with wl-screenrec as no change has been made to
its call signature in omarchy-cmd-screenrecord and the wl-screenrec
binary is not included in the default omarchy installation.
This commit is contained in:
observable
2025-09-24 13:37:56 -05:00
parent 2df8c5f7e0
commit d4b0ba5d94

View File

@@ -15,7 +15,7 @@ SCOPE="$1"
AUDIO=$([[ $2 == "audio" ]] && echo "--audio") AUDIO=$([[ $2 == "audio" ]] && echo "--audio")
start_screenrecording() { start_screenrecording() {
filename="$OUTPUT_DIR/screenrecording-$(date +'%Y-%m-%d_%H-%M-%S').mp4" local filename="$OUTPUT_DIR/screenrecording-$(date +'%Y-%m-%d_%H-%M-%S').mp4"
if lspci | grep -qi 'nvidia'; then if lspci | grep -qi 'nvidia'; then
wf-recorder $AUDIO -f "$filename" -c libx264 -p crf=23 -p preset=medium -p movflags=+faststart "$@" & wf-recorder $AUDIO -f "$filename" -c libx264 -p crf=23 -p preset=medium -p movflags=+faststart "$@" &
@@ -47,7 +47,8 @@ screenrecording_active() {
if screenrecording_active; then if screenrecording_active; then
stop_screenrecording stop_screenrecording
elif [[ "$SCOPE" == "output" ]]; then elif [[ "$SCOPE" == "output" ]]; then
start_screenrecording output=$(slurp -o) || exit 1
start_screenrecording -g "$output"
else else
region=$(slurp) || exit 1 region=$(slurp) || exit 1
start_screenrecording -g "$region" start_screenrecording -g "$region"