1

I seem to be unable to make xdotool work. I'm trying to emulate keyboard shortcuts as Super+Left via external output. I looked it up and xdotool seems to do exactly that, emulate keyboard strokes. But when I run my script I get this error:

Qt: failed to retrieve the virtual modifier names from XKB

when running something like this from my code:

xdotool key super+Left

But if I do the same, and others shortcuts as (Ctrl+Alt+T), from a common terminal I get nothing at all as output, the process just finishes.

Obviously I have no expirience with this tool so probably I'm missing something but I can't figure out why and I don't see this error replicated anywhere.

Edit:

My "external output" is a python script that given circumstances executes different commands like this:

process = subprocess.Popen(command)
output, error = process.communicate()

I'm using Ubuntu 21.04.

AdminBee
  • 22,803
  • Not sure what you mean by "via external output". And, are you using Wayland or X11? - as it is XKB I guess X11 but ... https://unix.stackexchange.com/q/202891/140633 – And do you mean ctrl+alt+t? (as in + between alt and t). Without it you should end up with a t in your terminal ~ before new prompt. It could also be useful if you include distribution and desktop you use. – ibuprofen Jun 27 '21 at 05:51
  • I was using wayland, I changed to x11 and xdotool started working on my terminal. I will explain better my external output and distro editing my post. Thanks – Ulises Torrella Jun 27 '21 at 15:13
  • Ah, OK. xdotool is made for X11. I am not updated on the status of similar tools on Wayland, but from the design choices it is (was?) not possible. It is a security measure, and for me one of the reasons I stick with X11 (screen sharing, screenshots, UI automation, automated input, scripted window management, ...). IIRC there are some tools that do some things - but require root access, which, well, is not something I want to do. Try searching the web for things like Wayland xdotool and similar. – ibuprofen Jun 27 '21 at 15:42

1 Answers1

1

My problem was in the way I was executing the subprocess.

I changed my python code to:

subprocess.call(command) 

and that did the trick