How do I make Gnome Shell under Wayland ignore an input device?

Under X, it’s trivial to ignore a specific input device.

# Disable the Gryphon barcode scanner "keyboard"
for id in `xlist Datalogic`; do
    xinput float $id
done

Is there a way to do this under Wayland? Note that I don’t want to disable the device — I’m parsing (via a program) the output from it, and I just want Gnome to ignore it.

That’s the question, but here’s the background:

I have an Emacs-based package for keeping track of my books. It’s ISBN based, but nobody wants to punch all those numbers by hand, so I use this nice thing:

It’s a cordless Datalogic QuickScan barcode scanner (expertly wrapped with some gaffa, as such things should be), and it appears as a normal USB HID keyboard in Linux.

So when I scan something, the sequence of “9780062309686 ENTER” appears, as if from a normal keyboard.

Now, if I’m in a bookiez buffer in Emacs, everything works automatically. But I want this scanner to work no matter what program has focus. That way I can just pick up the scanner (that’s on the table in the hall) when I’ve bought a new book, and just *BEEP* the book without interacting with the computer at all otherwise — giving the right programme focus, etc.

To do this, I basically parse the output from libinput, and that’s trivial to do, and I’ve been doing this stuff for a decade. And as I said at the top, it’s trivial to make X ignore the device, but how to do this on Wayland, under Gnome Shell?

Because this is kinda crap:

After googling a bit, I found a gazillion people asking the same question, and the solution they found was to use udev to disable the device completely. Which isn’t what I want — I want to have it enabled, but ignored by Wayland.

I also asked ChatGPT, and it told me to go fuck myself:

Surely Wayland has a way to do something this basic without *gurgle*. Surely!.

SURELY!!!

[edit a bit later]

D’oh! I missed this output from ChatGPT — this does indeed seem to kinda sorta work in my use case… I mean, it’s a gross hack and all, but…

SO NEVER MIND

Leave a Reply