diff options
Diffstat (limited to 'dot_local')
| -rwxr-xr-x | dot_local/bin/executable_rqr | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/dot_local/bin/executable_rqr b/dot_local/bin/executable_rqr index 76ea698..5b768ce 100755 --- a/dot_local/bin/executable_rqr +++ b/dot_local/bin/executable_rqr @@ -1,6 +1,24 @@ #!/usr/bin/env dash -text="$(zbarcam -q -1 --raw)" +set -eu + +camera="" +for candidate in \ + /dev/v4l/by-id/*HP_430_435_FHD_Webcam*-video-index0 \ + /dev/v4l/by-id/*-video-index0 \ + /dev/video*; do + if [ -e "$candidate" ]; then + camera="$candidate" + break + fi +done + +if [ -z "$camera" ]; then + echo "rqr: no camera found" >&2 + exit 1 +fi + +text="$(zbarcam -q -1 --raw "$camera")" printf '%s' "$text" | wl-copy echo "$text" |
