0

I'm running Fedora 22; and I'm trying to create a very simple keyboard macro script with uinput that will work across display servers (and in console).

Following this post I figured out how to do this successfully in console and with evdev;

However I also want to be able to do this through libinput (for wayland, mir and X11); does anoyone know how that can be done?

3
  • 2
    Rename your file to something other than uinput.py and try again. Commented Feb 16, 2016 at 19:53
  • Also delete any uinput.pyc Commented Feb 16, 2016 at 19:54
  • @VincentSavard Doh that is so elementary! That's what I get for not being used to imports (it's also been a while since I touched any code beyond bash scripts, in my defense). I rephrased the question to fit my current predicament after I got it compiling. Thanks for your help, and sorry for the mess. Commented Feb 16, 2016 at 20:22

1 Answer 1

2

This question doesn't quite make sense in its current form, you're confusing two different layers of the stack.

libinput is a library to handle events coming from kernel evdev devices. It does things like two-finger scrolling, touchpad gestures, mouse wheel emulation, etc. For keyboards, it pretty much just forwards whatever the kernel gives it (keyboard layouts are handled by the compositor and the client).

uninput is a kernel interface to create virtual devices that then show up as kernel evdev device nodes. libinput does not care whether a device is a physical device or a virtual uinput device (in fact, libinput's test suite uses uinput devices heavily).

So a device created by uinput sits below libinput, any keyboard device that you create with uinput will show up as keyboard in a compositor using libinput. Thus any key event will be forwarded just as from a normal keyboard.

Now, you could try to add macro support to libinput directly, but that's a lot harder to do and has virtually no chance of getting upstream. For a local use-case, a uinput-based solution should be sufficient.

Sign up to request clarification or add additional context in comments.

3 Comments

I was hoping to create a third party macro program which would fool libinput into thinking that there were inputs coming from the keyboard by using uinput. But you're saying I can instead create a virtual keyboard device with uinput that libinput will be able to read?
yes, a keyboard created with uinput will look the same as a real keyboard to libinput
Thanks, I'll try that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.