Comments (11)
Made a simple sh
wrapper to work around this: https://gist.github.com/shvchk/ecfcb9c43050a08cb55ece9efb935da9
from xdotool.
I wonder if this is a race condition. search
will list windows (via XQueryTree), then, for each window listed, queries the window's properties.
If a window is given by XQueryTree, and then before the window properties are queried, that window is deleted, then I could see how this error occurs.
The fix may be to have libxdo's search feature ignore BadWindow errors.
from xdotool.
Is there any other circumstance that might cause a BadWindow
error, or is this the only one ?
Would you have any suggestion on how I could debug this scenario so that I can give you more information to analyze ? Of course, if you need more information. I confess: my knowledge of X programming is 0.
from xdotool.
Workaround:
set +e
WINDOW_ID=$(xdotool search --name "Foo*")
set -e
from xdotool.
I'm getting the same problem on Ubuntu 18.04 with xdotool version 3.20160805.1.
If I start the PC, start Firefox, and then later run xdotool to find it, I get the error on the first attempt, then subsequent attempts are fine. The exact circumstances are somewhat difficult to pin down but it will sometimes reappear if I restart Firefox, (I always wait for it to start fully) and then the first attempt after that sometimes fails.
$ xdotool search --classname Navigator
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 15 (X_QueryTree)
Resource id in failed request: 0x1a343ef
Serial number of failed request: 402
Current serial number in output stream: 402
$ xdotool search --classname Navigator
56623120
I'm now running it twice, dumping errors from the first to /dev/null, but I can try to debug this if anybody's got suggestions as to how.
from xdotool.
I have the problem on Linux Mint 19, with xdotool 3.+20180415.1.
from xdotool.
Slack window id from --search: 18874369
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 12 (X_ConfigureWindow)
Resource id in failed request: 0x1200001
Serial number of failed request: 18
Current serial number in output stream: 20
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 3 (X_GetWindowAttributes)
Resource id in failed request: 0x1200001
Serial number of failed request: 18
Current serial number in output stream: 19
xdotool version 3.20160805.1
Ubuntu 19.04
from xdotool.
I've been getting this (the X_QueryTree error on first search) since I release upgraded to Kubuntu 19.10. But today, after a git pull and recompile, it's stopped happening. The previous version was built on 2019-10-03. I had scripted a retry on the first failure, after logging it.
No X windows were opening or closing when the error occurred. Yesterday it reproduced every time.
from xdotool.
I can confirm that I am getting the same issue on openSUSE tumbleweed with xdotool version 3.20160805.1.
I am running xdotool search --class "dota2"
in a terminal bash script. It runs roughly once an hour. Randomly ~5% of the time, it fails with this output:
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 15 (X_QueryTree)
Resource id in failed request: 0x2404083
Serial number of failed request: 489
Current serial number in output stream: 489
from xdotool.
I now work around this by looping with
errors=$(xdotool search --name whatever windowactivate 2>&1)
if [[ -z "$errors" ]]; then
.... no problem
break
fi
.... log error
Presently, f I invoke the script from a widget in a panel, it fails once every time. The same script from the menu gets no error.
from xdotool.
The problem persist in xdotool 3.20160805.1-2. When 'xdotool search' is launched repeatedly from a PyQt app, it fails randomly, about 1 time out of 30. Calling the function more slowly, ie. each 2s vs continuous blocking calls) reduce the likelihood of the error, so it look like a race condition..
It can be worked around but it's not pretty
def _embed(self, ref):
""" Find and embed the terminal window into a QWindow > QWidget > Layout """
fetch = QtCore.QProcess(self)
fetch.start(f"xdotool search --sync --classname {ref}")
fetch.waitForFinished()
wid = fetch.readAllStandardOutput().split("\n")[0]
err = str(fetch.readAllStandardError().split("\n")[0])
if wid:
self.window = QtGui.QWindow.fromWinId(int(wid))
self.widget = QtWidgets.QWidget.createWindowContainer(self.window, self)
self.widget.setSizePolicy(QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding)
self.gridLayout.addWidget(self.widget, 1, 0, 1, 3)
elif err.count("BadWindow"):
# Workaround for 'X Error of failed request: BadWindow (invalid Window parameter)'
# https://github.com/jordansissel/xdotool/issues/60
self._embed(ref)
else:
print(f"Null window id for '{self.name}': xdotool search --sync --classname {ref}")
from xdotool.
Related Issues (20)
- Impossible to chain "open thunderbird" + "resize window" HOT 2
- xdotool mousemove does not work on fc38
- Random mistake with type command
- Trouble getting xdo_click_window() function to work
- xdotool will not launch on Mint 21.2 Cinnamon
- xdotool key Alt+Tab on Ubuntu, not switch app window
- xdotool sets _NET_WM_NAME as a STRING when it needs to be set as UTF8_STRING
- Extremely strange bug - see attached video. HOT 2
- Add various random timing capabilities
- [Feature] Ability to query and change desktop names
- [Feature] Search for windows that are unmapped or visible on all desktops HOT 1
- Latest xdotool version in Ubuntu 22 repos silently fails on Wayland :sob: apt can't upgrade it, and manual doesn't help HOT 2
- Segfault when running over an ssh connection
- set_desktop --relative does not work for -1 HOT 2
- xdotool cannot send key combinations to Qt-based applications HOT 5
- XGetInputFocus returned the focused window of 1. This is likely a bug in the X server. HOT 1
- Search not seeing Steam Input On-Screen Keyboard HOT 7
- The character ":" is typed as "Q" in VM window HOT 1
- Xdotool works in Firefox but not Brave HOT 1
- behave_screen_edge only works with certain open windows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xdotool.