Giter VIP home page Giter VIP logo

Comments (3)

jordansissel avatar jordansissel commented on August 21, 2024

Then I tried opening another terminal window, and running:

a[uname@computer ~]$ xdotool search --class gnome-terminal key --window %@ a
[uname@computer ~]$

and nothing happened in either terminal.

This can sometimes happen and most of the time it is because the program is intentionally ignoring the keypress events sent by xdotool. GTK apps appear to do this by default, for example, such as gnome-terminal and Firefox. You can read more about this in the xdotool manpage under SENDEVENT NOTES if you want to know more about the phenomenon.

The best workaround I can offer is to send keyboard events only to the currently-active window. If you need to send keyboard events to multiple windows using this technique, you'll need to have xdotool search provide you a list of windows and then activate each window (bringing it forward and giving it focus for your keyboard/mouse events) and then send keystrokes.

For example:

 xdotool search --class gnome-terminal key | xargs -I@ -n1 xdotool windowactivate --sync @ type hello

This uses sends the list of window identifiers to a tool called xargs which will run xdotool for each window identifier printed by xdotool and uses '@' as a placeholder for the window identifier for each xdotool run.

The commands it runs uses:

  • windowactivate --sync -- this activates one window and waits for it to be the activated window
  • type hello this will send 'hello' to the active window as a sequence of keyboard events

Hope this helps!

from xdotool.

amillssma avatar amillssma commented on August 21, 2024

from xdotool.

amillssma avatar amillssma commented on August 21, 2024

from xdotool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.