Skip to content

Instantly share code, notes, and snippets.

@martonmiklos
Created March 21, 2022 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martonmiklos/145d974e24de79dbc9923bbddbc56f71 to your computer and use it in GitHub Desktop.
Save martonmiklos/145d974e24de79dbc9923bbddbc56f71 to your computer and use it in GitHub Desktop.
script for an udev rule to fix layout for a specific barcodereader
#!/bin/bash
usbkbd=`xinput -list | grep -c "USBKey Chip USBKey Module"`
if [[ "$usbkbd" -gt 0 ]]
then
usbkbd_ids=`xinput -list | grep "USBKey Chip USBKey Module" | awk -F'=' '{print $2}' | cut -c 1-2`
usbkbd_layout="us"
for ID in $usbkbd_ids
do
setxkbmap -device "${ID}" -layout "${usbkbd_layout}"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment