summaryrefslogtreecommitdiff
path: root/read-qrcode.sh
blob: 10bb595bff4fad6c2b1bd33f79d4aa6ef2feda04 (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
#!/bin/bash

# Create a temp file to store the screenshot
tmpfile=$(mktemp -u /tmp/flameshot-XXXXXX.png)

# Capture a screenshot to the temp file using flameshot GUI
echo flameshot gui -p "$tmpfile"
flameshot gui -p "$tmpfile"

# Wait until the file actually exists and is non-empty
sleep 1

# Decode QR code from screenshot
if [ -s "$tmpfile" ]; then
  echo "[INFO] Scanning image for QR codes..."
  zbarimg --raw "$tmpfile"
else
  echo "[WARN] No screenshot captured."
fi

# Clean up
rm -f "$tmpfile"