jesseduffield.lazygit/pkg
patwie 4f9dc0449c Add tmux and OSC 52 clipboard fallbacks for headless hosts
On a headless SSH host there is no X11 or Wayland display, so none of
xclip, xsel, or wl-copy can reach a clipboard. atotto/clipboard then
reports itself unsupported and every copy action fails with "No
clipboard utilities available", even though installing those tools
cannot help without a display server. This breaks copying branch
names, commit hashes, file paths, and diffs in the common setup of
developing on a remote box over SSH inside tmux.

Extend CopyToClipboard and PasteFromClipboard with a built-in fallback
chain that only engages when no os.copyToClipboardCmd is configured
and clipboard.Unsupported is true, so any setup with a working native
utility or a configured command is completely unaffected.

When running inside tmux, copy via `tmux load-buffer -w -` and paste
via `tmux save-buffer -`. The -w flag relays the buffer to the outer
terminal's system clipboard through tmux's own OSC 52 emission (with
`set-clipboard on`), and because the tmux buffer is readable this
gives real bidirectional clipboard support within the session,
including paste.

Without tmux, emit an OSC 52 escape sequence to the controlling
terminal, so terminals that support it still receive the copy. OSC 52
read-back is refused by most terminals for security reasons, so paste
returns the last value copied in-session, matching how Neovim's and
Helix's clipboard providers behave. The sequence framing is factored
into a pure buildOSC52Sequence so it can be verified without touching
the terminal.

Failing both, fall through to the native atotto path unchanged.

Fixes #5724
2026-07-14 20:40:04 +00:00
..
app Allow overriding the platform used for default keybindings 2026-07-03 19:08:22 +02:00
cheatsheet Render every key for a binding in the cheatsheet 2026-05-25 15:18:18 +02:00
commands Add tmux and OSC 52 clipboard fallbacks for headless hosts 2026-07-14 20:40:04 +00:00
common Move NewDummyCommon to pkg/common 2025-05-06 09:43:26 +02:00
config Add gui.shrinkSidePanelsToContent option 2026-07-03 19:25:01 +02:00
constants Make the links in the status panel point to the current version rather than master 2024-03-22 08:13:59 +01:00
env Support bare worktrees where worktree does not have its own .git file 2023-08-07 22:40:53 +10:00
fakes Modernize all codes 2025-11-15 10:46:23 +01:00
gocui Cache each line's wrapping so scrolling doesn't re-wrap the whole buffer 2026-07-09 09:32:35 +02:00
gui Fix data race on the triggerFetch field 2026-07-10 17:16:46 +02:00
i18n Don't invite for contributions at startup 2026-07-14 14:54:56 +02:00
integration Make integration tests using commits more robust 2026-07-09 11:56:27 +02:00
jsonschema Fold legacy quit-alt1 into the multi-key quit binding 2026-05-25 15:32:47 +02:00
logs Fix Windows linter errors 2026-06-16 16:21:13 +02:00
snake Enable intrange linter, and fix warnings 2025-06-30 18:30:11 +02:00
tasks Synchronize ViewBufferManager.Close with a starting task 2026-07-09 14:28:29 +02:00
theme Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
updates Change direct access to Common.UserConfig to a getter 2024-08-18 10:24:52 +02:00
utils Expand a leading ~ in worktree paths to the home directory 2026-07-03 18:53:05 +02:00