summaryrefslogtreecommitdiffstatshomepage
path: root/dot_local/bin/executable_rqr
blob: 5b768ceaae8d85d57a71cbec0e6bcd4dc88d23e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env dash

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"
notify-send "$text"