mirror of
https://github.com/open-webui/computer.git
synced 2026-11-05 01:17:24 +00:00
[GH-ISSUE #161] bug: Terminal has no way to copy selected text (desktop web & mobile) #83
Labels
No labels
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/computer#83
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @chitacdcolorrrr on GitHub (Jul 22, 2026).
Original GitHub issue: https://github.com/open-webui/computer/issues/161
Bug
Text selected in the web terminal can never reach the clipboard. There is no working copy path on desktop browsers, and no copy affordance at all on touch devices. Paste works fine (via keyboard), so the terminal is effectively one-way.
Reproduction
cptr run --host 0.0.0.0, open the UI from another device (or any browser).Cmd+C/Ctrl+Shift+C→ nothing lands on the clipboardRoot cause (from the shipped frontend bundle, v0.9.12)
The terminal's custom input layer registers these handlers:
So:
copyevent handler exists. The selection highlight is purely visual (canvas-rendered, not a DOM selection), so the browser's built-in copy can't help, and nothing movesselectionTextinto the clipboard.contextmenuispreventDefault'd, which also defeats xterm.js's built-in right-click fallback (focus hidden textarea + select text so the native menu's "Copy" works).onLinuxMouseSelection, which just populates the hidden textarea (X11 PRIMARY semantics) — no clipboard write, and Linux-only anyway.Side note: all other copy buttons in the UI use
navigator.clipboard.writeText()with no fallback. When the UI is served over plain HTTP on a LAN IP (http://192.168.x.x:8000), that's not a secure context, sonavigator.clipboardisundefinedand those buttons silently fail too. A warning toast would help discoverability.Suggestions
copyevent listener on the terminal's input element:e.clipboardData.setData('text/plain', term.getSelection())works even in insecure contexts, no permissions needed — this fixes keyboard copy on desktop for free.preventDefaultcontextmenuon desktop; or replace it with a small custom menu (Copy / Paste) like most web IDEs do.execCommand('copy')fallback or a visible warning whennavigator.clipboardis unavailable.Environment
Disclosure: this issue was investigated, root-caused, and drafted by Kimi K3 while helping me debug the terminal copy behavior in a chat session, and is submitted on my behalf at my request. The analysis above is based on reading the shipped v0.9.12 frontend bundle; I verified the described behavior reproduces on my setup.