From 27ac4658dcbe38f558cd9cc73aee970a8f545894 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Mon, 4 Sep 2023 21:44:05 -0500 Subject: [PATCH] fix(hypr): autodetect graphics card for screen caps --- dots/.config/hypr/scripts/screen-cap.bash | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dots/.config/hypr/scripts/screen-cap.bash b/dots/.config/hypr/scripts/screen-cap.bash index 37053c59..506635bb 100755 --- a/dots/.config/hypr/scripts/screen-cap.bash +++ b/dots/.config/hypr/scripts/screen-cap.bash @@ -30,7 +30,14 @@ mk-video() { tmp_dir="$(mktemp -d)" cd "${tmp_dir}" input_tmpfile="${tmp_dir}/$(mktemp wf-recorder.XXXXXXXXXXX).mp4" - wf-recorder -g "$(slurp)" -f "${input_tmpfile}" -c h264_vaapi -d /dev/dri/card0 -- & + local card + card="$(find /dev/dri -maxdepth 1 -name "card*" -print -quit)" + if [[ -n "${card}" ]]; then + wf-recorder -g "$(slurp)" -f "${input_tmpfile}" -c h264_vaapi -d "${card}" -- & + else + notify-send "Card Detection" "Did not detect a card to use, encoding will be slower!" -a "${program_name}" -u critical + wf-recorder -g "$(slurp)" -f "${input_tmpfile}" -c h264_vaapi -- & + fi printf "%s" $! >"${pid_file}" wait if [[ "${output_type}" == "gif" ]]; then