Is it possible to search for both the --class and --name using xdotool?

xdotool search --all --onlyvisible --class "some_val" --name "another val"

The above returns an error because the first condition, --class, already returns window ids before --name can be used to filter the results:

 xdotool: Unknown command: --name

The tricky thing is that --class, --name, and --classname options to the search command do not take an argument. (This has tripped many, I think.) They modify what the search command looks at.

Chaining searches doesn't work, either; the second search discards the results of the first.

All I can suggest is to use shell scripting. Here's one way:

( xdotool search --all --onlyvisible --class 'some_val'
  xdotool search --name 'another val' ) |
    sort | uniq -d
  • Wow, this is some seriously unintuitive behavior. Thanks for clarifying that.
    – Rapti
    Jul 28 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.