Wait for window manager readiness

Co-authored-by: codegirl007 <codegirl-007@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-08-17 16:40:23 +00:00
co-authored by codegirl007
parent ad5a4b4114
commit 54dc5658c6
2 changed files with 20 additions and 1 deletions
+19
View File
@@ -36,6 +36,25 @@ done
openbox --sm-disable >/tmp/openbox.log 2>&1 &
OPENBOX_PID=$!
attempt=0
while :; do
wm_info=$(xprop -root _NET_SUPPORTING_WM_CHECK 2>/dev/null || true)
case "$wm_info" in
*"window id #"*) break ;;
esac
if ! kill -0 "$OPENBOX_PID" 2>/dev/null; then
echo "Openbox exited before becoming ready" >&2
exit 1
fi
attempt=$((attempt + 1))
if [ "$attempt" -ge 100 ]; then
echo "Openbox did not become ready" >&2
exit 1
fi
sleep 0.05
done
touch /tmp/agentbox-ready
while :; do
+1 -1
View File
@@ -155,7 +155,7 @@ func Run(ctx context.Context) (runErr error) {
var windowID string
if err := r.waitFor(ctx, 10*time.Second, func() bool {
output, searchErr := r.docker(ctx, "exec", r.containerName, "xdotool",
"search", "--onlyvisible", "--name", "Agentbox Mover")
"search", "--name", "Agentbox Mover")
if searchErr != nil {
return false
}