Compare commits
6 Commits
d33a375a44
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
1fbab72252
|
|||
|
b3a36a9f3c
|
|||
|
2ccd54fe11
|
|||
|
f63038e439
|
|||
|
1851aeae89
|
|||
|
cb430b869a
|
@@ -16,7 +16,7 @@ RestartSec=3
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
" > HOME/.config/systemd/user/webcam-barcode.service
|
||||
" > $HOME/.config/systemd/user/webcam-barcode.service
|
||||
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now webcam-barcode.service
|
||||
|
||||
20
scan.sh
20
scan.sh
@@ -3,17 +3,21 @@
|
||||
# Debian: sudo apt-get install zbar-tools xdotool mpv
|
||||
# Arch: sudo pacman -S zbar xdotool mpv
|
||||
|
||||
if [[ $XDG_SESSION_TYPE != "x11" ]]; then
|
||||
echo "Unsupported session type: $XDG_SESSION_TYPE"
|
||||
exit 1
|
||||
fi
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
|
||||
|
||||
|
||||
zbarcam $1 | while read line; do
|
||||
zbarcam --nodisplay $1 | while read line; do
|
||||
if [[ $line == *:* ]]; then
|
||||
code="${line#*:}"
|
||||
echo "$code"
|
||||
xdotool type --delay 0 "$code" & mpv --quiet --no-video beep.mp3 >> /dev/null
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user