diff --git a/scan.sh b/scan.sh index ca4767d..6a85ff3 100755 --- a/scan.sh +++ b/scan.sh @@ -9,7 +9,15 @@ zbarcam --nodisplay $1 | while read line; do if [[ $line == *:* ]]; then code="${line#*:}" echo "$code" - wtype "$code" & xdotool type --delay 0 "$code" & mpv --quiet --no-video beep.mp3 >> /dev/null - wtype $'\n' & xdotool key Return + + if ls /run/user/$(id -u)/wayland-*.lock > /dev/null 2>&1 + then + wtype "$code" & mpv --quiet --no-video beep.mp3 >> /dev/null + wtype $'\n' + else + xdotool type --delay 0 "$code" & mpv --quiet --no-video beep.mp3 >> /dev/null + xdotool key Return + fi + fi done