Skip to content

Commit bb066c5

Browse files
authored
fix computer controls hang (#92)
using --sync was ill-advised, it doesn't seem to detect when no mouse movements are necessary to achieve a mousemove, so getting rid of it for now <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Removes the `--sync` flag from all `xdotool mousemove` calls to prevent hanging during mouse operations. > > - **Backend (computer controls)** in `server/cmd/api/api/computer.go`: > - Remove `--sync` from `xdotool mousemove` in: > - `MoveMouse` > - `ClickMouse` > - `Scroll` > - `DragMouse` (initial move to start point) > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 429cec9. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent ce46982 commit bb066c5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/cmd/api/api/computer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (s *ApiService) MoveMouse(ctx context.Context, request oapi.MoveMouseReques
6262
}
6363

6464
// Move the cursor to the desired coordinates
65-
args = append(args, "mousemove", "--sync", strconv.Itoa(body.X), strconv.Itoa(body.Y))
65+
args = append(args, "mousemove", strconv.Itoa(body.X), strconv.Itoa(body.Y))
6666

6767
// Release modifier keys (keyup)
6868
if body.HoldKeys != nil {
@@ -156,7 +156,7 @@ func (s *ApiService) ClickMouse(ctx context.Context, request oapi.ClickMouseRequ
156156
}
157157

158158
// Move the cursor
159-
args = append(args, "mousemove", "--sync", strconv.Itoa(body.X), strconv.Itoa(body.Y))
159+
args = append(args, "mousemove", strconv.Itoa(body.X), strconv.Itoa(body.Y))
160160

161161
// click type defaults to click
162162
clickType := oapi.Click
@@ -515,7 +515,7 @@ func (s *ApiService) Scroll(ctx context.Context, request oapi.ScrollRequestObjec
515515
args = append(args, "keydown", key)
516516
}
517517
}
518-
args = append(args, "mousemove", "--sync", strconv.Itoa(body.X), strconv.Itoa(body.Y))
518+
args = append(args, "mousemove", strconv.Itoa(body.X), strconv.Itoa(body.Y))
519519

520520
// Apply vertical ticks first (sequential as specified)
521521
if body.DeltaY != nil && *body.DeltaY != 0 {
@@ -626,7 +626,7 @@ func (s *ApiService) DragMouse(ctx context.Context, request oapi.DragMouseReques
626626
}
627627
}
628628
start := body.Path[0]
629-
args1 = append(args1, "mousemove", "--sync", strconv.Itoa(start[0]), strconv.Itoa(start[1]))
629+
args1 = append(args1, "mousemove", strconv.Itoa(start[0]), strconv.Itoa(start[1]))
630630
args1 = append(args1, "mousedown", btn)
631631
log.Info("executing xdotool (drag start)", "args", args1)
632632
if output, err := defaultXdoTool.Run(ctx, args1...); err != nil {

0 commit comments

Comments
 (0)