-
Notifications
You must be signed in to change notification settings - Fork 347
Open
Description
Add support for copying selected text to the system clipboard using OSC52 escape sequences, enabling clipboard functionality in terminal emulators that support this standard.
Problem
Currently, when using Codebuff CLI in terminal emulators like Ghostty, Kitty, iTerm2, or others:
- Text selection doesn't copy to clipboard - Even with
copy-on-select = clipboardenabled in the terminal, selected text within Codebuff doesn't get copied to the system clipboard - Standard copy shortcuts are intercepted -
Ctrl+CandCtrl+Shift+Care captured by Codebuff for other purposes (exit confirmation, etc.) - Clipboard managers don't receive selections - Tools like
cliphist,elephant-clipboard, or other clipboard history managers never see text selected within Codebuff
This happens because Codebuff is a TUI (Text User Interface) application that captures mouse events, preventing the terminal emulator from handling copy-on-select functionality.
Proposed Solution
Implement OSC52 clipboard support to automatically copy selected text to the system clipboard. The OSC52 escape sequence format is:
\e]52;c;<base64-encoded-text>\a
This is a widely-supported standard that works with:
- Ghostty
- Kitty
- iTerm2
- Alacritty
- Windows Terminal
- Many others
Use Cases
- Quick code copying - Users often want to copy code snippets, file paths, or command outputs from Codebuff responses to use elsewhere
- Clipboard history integration - Allow clipboard managers to track text copied from Codebuff
- Workflow efficiency - Eliminate the need to manually re-type or use workarounds to get text out of the TUI
Alternatives Considered
- Using
wl-copy/xclipdirectly - Requires external dependencies and doesn't work consistently across platforms - Dedicated copy keybinding - Would help, but
copy-on-selectbehavior is more intuitive for terminal users - Writing to files - Current workaround, but adds unnecessary friction
Additional Context
- Environment: Ghostty 1.2.3 on Arch Linux (Hyprland/Wayland)
- Clipboard manager: elephant-clipboard (via Walker)
- The terminal's
copy-on-selectworks perfectly outside of Codebuff TUI, confirming this is a TUI-specific issue
Metadata
Metadata
Assignees
Labels
No labels