Skip to content
loomhandPublic
forked from trycua/cua

About

Fork of trycua/cua with Linux X11 fixes to cua-driver, synced daily; patches on dev, upstream on main

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

 
 

Latest commit

 

History

8,079 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

loomhand/cua

A fork of trycua/cua that carries Linux X11, macOS and Windows fixes to cua-driver, the screen executor in loomhand cloud desktops. Every fix is sent upstream; this fork only holds them until they land. Upstream's own README is README.md.

Branches

Branch What
main trycua/cua main, fast-forward only, never changed here
dev (default) main plus the patches below and the fork workflows
fix/* head branches of the open upstream pull requests

Patches on dev

Patch Upstream
macOS and Windows: click with verify_hit fronts an element's window and posts a pixel click at its centre only when the hit test there finds the element, and on macOS like any desktop click refuses a point on a security or consent prompt (upstream #7338) and, like an element click, a control behind an attached sheet (upstream #7798); a Linux click refuses verify_hit as an unknown argument RFC #6031; salvage #8982 open
macOS: the live on-screen order that ranks z_index (upstream #8158) comes from an ids-only on-screen window list, read only where z_index is read, so no other window enumeration makes a second pass fork only
macOS: a pixel action takes the capture scale that a read of the same window at the same bounds, under the same display layout, already proved, instead of capturing the window again fork only
macOS: a background pixel click on a text input whose AXPress leaves it unfocused (a Qt line edit takes the press as a no-op) gives it the keyboard focus, as a real click does #6118, salvage #9003 open
Linux: with no desktop variable set, a session whose GNOME Shell owns its bus name counts as GNOME, so the advertisement is IsEnabled only and Orca does not start #6120, salvage #9005 open
macOS: a locked_input reply names where the keys went: the lock screen for loginwindow's pid, otherwise the key window of that pid as it was before the lock fork only, on upstream's locked_input (#9020)
Windows: the shared IPC client (LocalIpcClient, LocalIpcStream) refuses a named pipe whose server process runs as another Windows account, before any write, so every daemon client does fork only, reported upstream
Windows: a XAML hotkey whose UI Automation accelerator scan runs out of time, or whose matched element's Invoke or Toggle fails, answers background_unavailable with reason earlier_call_failed and effect unverifiable (a timeout adds cause_code: app_unresponsive), like the fork's element click after a failed pattern call, so its hint says to read the window again and nothing offers a foreground retry; the scan stops at that element, since the action may already have reached it. Upstream refuses both with effect refused, which invites a foreground retry. A scan that timed out in its element walk, before any Invoke or Toggle, gets the same answer: the provider that did not answer in 4 s is hung, and foreground keys to a hung app queue until it returns, so the reply leaves that call to the caller. A scan that cannot start because an earlier UI Automation call has not returned is refused with app_unresponsive fork only
Windows: no-element type_text writes through the focused UIA document at its caret or selection (one selection, at most 1M characters), with read-back and a verified caret, instead of Unicode packets that Windows 11 Notepad collapsed; the write leaves no modified marker or undo step and skips Autocorrect #6995, salvage #9080 open
Linux: a window capture reads only the part of the window on the screen and pads the rest black, so a window past the screen edge no longer fails with BadMatch the same fix is third-party #5742
Linux: with CUA_DRIVER_RS_REMOVE_MPX_MASTERS=1 in the daemon's environment, the XInput2 master pairs the driver takes are removed when released, never pooled, as before upstream #7358: each session adds a fresh pair, end_session, the idle teardown and the popup waiter remove it, a failed attach removes it, and startup removes pairs whose holder, or whose free pair's creator, is gone; unset, upstream's pooling is unchanged. Removal crashes running Qt 6.5+ apps (#7325); a pooled master keyboard makes Chrome on X11 drop core keyboard input upstream merged #9126, on main after cua-driver-rs 0.72.0
macOS: a batched type_text that a native field showed no change for is not retyped, so a field whose value lags the keys, or a view that does not echo them, never takes the text twice #8409
macOS: an unconfirmed terminal insert says a terminal may not echo what it reads and the text must not be typed again, with no foreground escalation upstream merged #8396, on main after cua-driver-rs 0.72.0
macOS: a read-back that changed without growing is unverifiable; an AXSelectedText write that changed the field is not followed by keys, and the key rung gives up once the value stops moving #9112, for issue #7244
macOS: a terminal confirms typed text only by a copy its scrollback did not already hold, and never when its value could not be read before the keys upstream merged #9106, on main after cua-driver-rs 0.72.0
Windows: get_window_state sets screenshot_composited: true, as the Linux driver does, when the window image is a copy of its screen region, taken after the window's own capture failed, and returns an occluded copy where upstream refuses it; the consumer masks it #9101; returning the occluded copy is fork only
all platforms: the element_token snapshot counter starts at a random value in each driver process, so a token kept across a driver restart is refused as stale instead of naming a row of a newer snapshot with the same id #8364
Windows: a foreground action attaches to the foreground window's thread only when that window answers a WM_NULL within 250 ms, so a hung foreground app no longer stalls a click, key or bring_to_front until it pumps again #8363
Windows: an element action reads the element's IsEnabled and IsOffscreen, and a background click its Invoke, Toggle, SelectionItem and ExpandCollapse patterns, within 2 s, and scrolls it into view within 4 s, each on a worker under a single-flight gate per target process, so an app whose UI thread is hung costs about 2 s and one stuck thread instead of UI Automation's own timeout per read, and holds up only its own reads; UWP apps share their frame host's gate, so a hung one also holds up other UWP apps' element reads. A busy or late read refuses the action before any input with app_unresponsive, whose recovery hint says to wait for the app and read the window again, except that a refusal or an incomplete send after a failed pattern call, which may still take effect, answers that the effect is unknown with the follow-up's code as cause_code, and advises no foreground retry in its text, its fields or its hint, which says to read the window again; a late or busy IsEnabled read refuses click, double_click, right_click, set_value, type_text, press_key, hotkey and scroll on an element before any input, and only the first five also refuse an element that reports IsEnabled=false, as upstream does. An app that hangs between a timely read and the action, or inside the Invoke, Toggle, Select or Expand call itself, still waits as before; so does a background element press_key in cua-driver-rs 0.69.0's reads of the element's window handle, its own and, in a window with a Chromium descendant, up to 64 parent elements' (#7951), which run after the timely reads and outside the per-process gate #8362
Windows: a non-activating click or drag restacks the previous foreground window only when it answers a WM_NULL within 250 ms, so a hung previous foreground window no longer stalls it and stays where the click left it not yet offered upstream
Windows: a background press_key, hotkey or type_text sent to a window, without an element or x,y, first checks that the thread of the window that takes the posted keys answers a WM_NULL within 2 s, and refuses with app_unresponsive and no input sent when it does not; type_text checks before it sets the window's no-activate style. A hung app otherwise queued the posted keys and took them when it woke, up to a minute later, after a reply of effect unverifiable whose foreground retry delivered the key twice; a window that UIPI keeps the check from reaching still gets the UIPI refusal, and a window that no longer exists gets the post's own error #9110, on #8362 and #8363
Windows: a positioned verify_hit click waits 40 ms after mouse-up, not upstream's 120 ms for a window click, since its cursor is already on the click point and it restores no z-order; every other window click keeps 120 ms, since v0.53.2-loomhand.3 waited 40 ms before the cursor restore upstream #5772 brought back, the click-loss race the 120 ms guards against not yet offered upstream
macOS: a type_text send that a native field showed no change for (batched, paced with delay_ms, or foreground key events) answers that the keys were sent and the effect is unknown, and that the field must be read before typing again (effect: "indeterminate", retryable: false, no retry_from_character), instead of a retry of the whole text from character 0 #8664
macOS: a background hotkey whose menu item macOS keeps disabled while the app is inactive (TextEdit's Select All, Bold) is refused with background_unavailable, effect: "refused" and a foreground escalation, instead of keys that never reach the app's menus; LibreOffice, whose VCL takes the shortcut as keys, still gets the keys; every menu-route error after the call wrote the keyboard focus names that element in the text, and in refusal.message when the result carries one; an x,y or web-content target whose focus write was skipped because its element already held the focus gets no note #8665
macOS: a background Save whose scripted save was sent but did not confirm (the app still reports unsaved changes, answered something unexpected, or its modified flag could not be read after the save), or that timed out after 30 s and may have reached the app, answers save_indeterminate, effect: "indeterminate", retryable: false, with advice to read the document first, instead of a background_unavailable refusal that invites a second save in the foreground; an app macOS has not yet asked Automation consent for is refused at once with that refusal, on every call until consent is granted, while macOS may ask the user on its own thread, one request per app at a time, instead of a call held 30 s by the prompt; Finder rename, the Safari <select> fallback of set_value and the page tool's browser JavaScript take the same check; the page tool's route checks the browser it scripts (Google Chrome for a Chrome app shim, and with --no-automation-prompts the shim itself too, as before), and only after its window owner and single-instance checks #8666; the never-asked consent refusal is fork only
macOS: an Automation-denied refusal names the app that holds the driver (its display name, else its bundle name), as macOS's own consent alert does when the driver is embedded in another app, instead of always Cua Driver; the standalone CuaDriver.app still reads Cua Driver, and the name is read only when a denied reason is built #9102
macOS: a Finder rename that timed out, or that Finder accepted while its folder does not list the new name yet, answers that the rename may have reached Finder and that the item's name must be read before renaming again (effect: "indeterminate"), instead of saying the file keeps its name; every other failed rename still says the file keeps its name #9103
all platforms: the Computer History writer lease retries its lock every 5 ms for up to 200 ms before answering WriterStopped, since a process spawned at the same moment holds an inherited copy of the lock until it execs, which failed a query or enable right after a disable #9104
macOS: the consent-label test accepts either apostrophe in Don't Allow, since some macOS label tables ship only the U+2019 form #9100
Windows: a background click with the middle button is refused before any input with the class-level background_unavailable refusal ("Background delivery is not available for target window class '…' on this event kind (mouse_click). Retry this action with delivery_mode:"foreground"…") and a foreground escalation, since UI Automation would run the element's default action, a left click; delivery_mode:"foreground" sends the middle button through SendInput not yet offered upstream

Before a box image moves its cua-driver pin to dev:

  • a desktop box has 19 free keycodes, and dev can use 18 of them, since it holds back 8;
  • the window routes (XSendEvent and XTest to the focused window) type a text with more distinct missing characters than free spare keycodes in batches, upstream since #5168;
  • the virtual-keyboard route and targeted XTest still fail such a text before typing anything; measured before #5168, a single call with 32, 64 or 120 distinct CJK characters typed 0 of 3, and calls of at most 8 distinct characters typed 18 of 18;
  • so the pin moves once the client's typing goes through the window routes, or keeps runs of at most 8 distinct characters on the other routes.

Upstream already:

  • keep the text's case under Caps Lock in Linux XTest typing, resolve an exact Linux frame match among cascaded windows of one size, take literal in type_text, send no Windows keys after a focused-document probe that did not answer in 2 s, and keep Windows text that replaced a selection out of the tail repair (#9074, #9075, #9076, #9081, #9087, merged in cua-driver-rs 0.72.0);
  • never defocus the window the macOS key-window records make key, wake a display that is off for a capture or refuse with display_asleep, and take locked_input on macOS background type_text and press_key, for an app's sole on-screen window only (#9015, #9019, #9020, merged in cua-driver-rs 0.71.0);
  • settle a Linux launch on the window of a process its launcher forked, and stamp the window-local point on a macOS background click before macOS 27 too (#9004, #9008, merged in cua-driver-rs 0.70.7);
  • type background text into kitty through AXValue, and find a macOS window on another Space through its app's focused and main window (#8977, #8980, merged in cua-driver-rs 0.70.4);
  • create every Windows daemon's first pipe instance with FILE_FLAG_FIRST_PIPE_INSTANCE, service mode included (#8448, in cua-driver-rs 0.65.0), which replaced the fork's own patch;
  • return app_unresponsive at once, without a walk, for a Linux app that did not answer GetChildren, while one GetState probe to its root is pending (#8380, salvaged from #6991, in cua-driver-rs 0.60.0);
  • rebase Chromium screen extents only from a frame the size of the target window (#8167, salvaged from #5414, in cua-driver-rs 0.55.1);
  • return at once from macOS bring_to_front when the exact window is already the focused frontmost window, which AppKit must agree is frontmost (#8163, salvaged from #5411, in cua-driver-rs 0.55.1);
  • accept a Windows click that closes or hides an unowned target window (#8166, salvaged from #5412, in cua-driver-rs 0.55.1), which replaced the fork's rule that accepted a destroyed target, owned dialogs included, with any foreground window;
  • rank macOS list_windows z_index by the live on-screen order and report null for off-screen windows (#8158, salvaged from third-party #5395, in cua-driver-rs 0.55.1);
  • name the app the driver runs in on the macOS permission guide (#8123, salvaged from #6985) and open the guide at the left of the screen, clear of System Settings' list (#8219, salvaged from #6984), both in cua-driver-rs 0.55.1;
  • never retype a batched macOS send into a terminal, and retype a native field only after it shows its old value followed by the text's first characters (#8128, salvaged from #7276, in cua-driver-rs 0.55.1);
  • wait 40 ms after a foreground Windows desktop click, as after a background one, and accept a click that hides its owned dialog when the foreground returns to the dialog's owner (#8160, salvaged from #5410, in cua-driver-rs 0.54.0), which replaced the fork's own rule that accepted a hidden target with any foreground window: #8160 covers the owned-dialog Save/OK case with the stricter owner rule;
  • wait for the spawned process's environment in the NO_AT_BRIDGE test (#7080, which superseded #7067);
  • confirm the Linux virtual keyboard's key events run by run and unplug it when keys stay unread (#7145, salvaged from #7076), and keep borrowed keycodes bound until 150 ms after a text's last key on them (#7146, salvaged from #7079);
  • read the macOS keyboard layout on the main queue in a process that runs AppKit, so press_key no longer traps in Text Input Sources (#6939, which replaced the fork's own fix for the same trap);
  • capture the macOS desktop with captureImage(in:) when there is no overlay to leave out (#6881, from #6028);
  • stop the macOS launch watchdog once the driver itself activates an app (#6803's focus arbiter, which replaced the fork's launch hold);
  • never borrow keycode 8 for a Linux text character (#5595, from #5592);
  • stop the Linux focus restore when the saved window is gone (#5596, from #5593);
  • paint the macOS cursor overlay as a region around the cursors, not a full-screen frame (#5650, from #5640);
  • restore the X11 active window by bouncing the core focus when only the window manager's record moved (#5651, from #5642);
  • skip the Space snapshot in the macOS background gate and the window-change detector (#5712, salvaged from #5641);
  • route keys for a popup an MPX click opened through the master keyboard of the session that clicked (#5652, from #5601);
  • leave the driver's own overlay windows out of Windows list_windows (#5566, from #5413);
  • keep an ended session's master pointer until the menu its click opened closes (#5254, salvaged from #4966);
  • leave focus on a dialog the clicked app opened (#5258, salvaged from #4965);
  • derive the macOS desktop point ratio from the display mode instead of a screenshot per action (#5340);
  • wait for the client, by _NET_WM_PING with its own serial and per window its keys went to, before using or restoring a borrowed keycode (#5172, salvaged from #4924);
  • type a long text in spare-keycode batches (#5168);
  • stop a batched text before rebinding keycodes the client has not confirmed reading (#5244, salvaged from #5238);
  • keep the Chromium screen rebase off a top-level frame that matches its window-manager frame (#4967, merged as 6e050d720);
  • fail type_text before typing anything when a character cannot be typed, with one spare keycode per distinct character (#5139, salvaged from #4922), and give each character of a text its own spare keycode (#5158, the change #4923 proposed).

Sync policy

main follows trycua/cua main and dev is rebased onto it by hand, by a repository admin:

git fetch upstream main
git push origin upstream/main:refs/heads/main                # fast-forward only
git switch dev && git rebase upstream/main                   # a patch upstream merged drops out; resolve conflicts here
git push --force-with-lease=refs/heads/dev:origin/dev origin refs/heads/dev:refs/heads/dev
gh workflow list -R loomhand/cua --all -L 1000 --json id,path,state --jq '.[] | select(.state == "active") | select(.path | test("/fork-") | not) | .id' | xargs -n1 gh workflow disable -R loomhand/cua
  • The Dev Build pre-release is the tag dev, so a push names the branch as refs/heads/dev in full.
  • Upstream's own workflows stay disabled in this fork; only the Fork: workflows run. A sync can bring new upstream workflows, which start active, so the last line runs after every push to main.
  • A sync leaves the fix/* branches of open upstream pull requests alone; a branch is rebased only when its pull request needs it.
  • cmgs/* branches are never rebased by a sync.

Builds

  • Fork: CI checks every push to dev: format, the cua-driver build and the Linux platform unit tests.
  • Fork: Build and Release Dev publishes cua-driver for Linux x86_64 and arm64 as the Dev Build pre-release at tag dev, with SHA256SUMS and build-info.json, built in Debian 11 like upstream's release.
  • Fork: Release publishes cua-driver for Linux (x86_64, arm64), macOS (arm64, x86_64) and Windows (x86_64) at each v*-loomhand.* tag, unsigned, with SHA256SUMS; a published release is never overwritten, so consumers pin its archives by sha256.

License

MIT, as upstream (LICENSE.md). The fork's patches are under the same terms.

About

Fork of trycua/cua with Linux X11 fixes to cua-driver, synced daily; patches on dev, upstream on main

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages