Skip to content

feat(linux): Qt5 focus-free write via synthetic focus events - #1812

Merged
r33drichards merged 1 commit into
claude/lucid-lovelace-CMVuMfrom
worktree-agent-a4514996e91ffe0d8
Jun 3, 2026
Merged

feat(linux): Qt5 focus-free write via synthetic focus events#1812
r33drichards merged 1 commit into
claude/lucid-lovelace-CMVuMfrom
worktree-agent-a4514996e91ffe0d8

Conversation

@r33drichards

Copy link
Copy Markdown
Collaborator

Summary

Implements focus-free background writes for Qt5 (PyQt5 QLineEdit) via synthetic X11 focus events.

Problem

  • Qt5 AT-SPI bridge only exposes widgets when window has focus (unlike Qt6 which works natively)
  • When unfocused, only top-level window node exposed

Solution

Three-tier typing strategy:

  1. AT-SPI Direct - Try native AT-SPI first (works for Qt6)
  2. Synthetic Focus - Send FocusIn → wait 100ms → retry AT-SPI → send FocusOut
  3. X11 Fallback - XSendEvent as last resort

Key Insight

Synthetic focus events trigger Qt5 AT-SPI bridge handlers without changing the window manager's active window. Truly focus-free.

Files Changed

  • platform-linux/src/atspi/mod.rs (+62 lines - type_into_editable)
  • platform-linux/src/input/mod.rs (+38 lines - send_focus_in/out)
  • platform-linux/src/tools/impl_.rs (+47 lines - three-tier strategy)
  • nix/cua-driver/tests/linux-background-gui.nix (+674 lines)

Testing

nix build .#checks.x86_64-linux.cua-driver-linux-background-gui-qt

@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jun 3, 2026 1:32am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c1574fd4-074f-4e7e-9fc2-6b00b0c856a3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-agent-a4514996e91ffe0d8

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Linux visual regression artifacts

Matrix jobs now run independently. Download GIF artifacts from this workflow run:

  • cua-driver-linux-cursor-click-gif
  • cua-driver-linux-background-terminal-gif
  • cua-driver-linux-background-gui-gtk
  • cua-driver-linux-background-gui-gtk4
  • cua-driver-linux-background-gui-qt
  • cua-driver-linux-background-gui-qt6
  • cua-driver-linux-background-gui-chromium
  • cua-driver-linux-background-gui-electron
  • cua-driver-linux-background-gui-tk

Open workflow run and download artifacts

…c focus events

Adds three-tier typing strategy for Linux:
1. Native AT-SPI EditableText (Qt6, GTK4 focus-free)
2. Synthetic FocusIn → AT-SPI → FocusOut (Qt5 workaround)
3. X11 XSendEvent fallback (terminal/legacy apps)

The synthetic-focus path sends FocusIn to trigger Qt5's AT-SPI bridge
without changing the X11 active window, enabling focus-free writes.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@r33drichards
r33drichards force-pushed the worktree-agent-a4514996e91ffe0d8 branch from 332f6eb to 243099a Compare June 3, 2026 01:32
@r33drichards
r33drichards merged commit e6504da into claude/lucid-lovelace-CMVuM Jun 3, 2026
9 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants