#!/bin/sh set -o pipefail main() { if wl-paste | zbarimg -q --raw - | wl-copy then notify-send "Copied" "QrCode was copied to clipboard" rm "$LOGFILE" else notify-send "Failed to read QrCode" "Log file is '$LOGFILE'" fi } LOGFILE=$(mktemp /tmp/qrcode-XXXXXXXX.log) main > "$LOGFILE" 2>&1