tmux / tmux

tmux source code
Other
35.29k stars 2.12k forks source link

Feature: Finer control over set-clipboard / copy-selection behaviour #4123

Closed hetmankp closed 1 month ago

hetmankp commented 1 month ago

Issue description

Current tmux behaviour means the set-clipboard option determines both the OSC 52 security level, and whether copying text into the tmux buffer also automatically sends it to the terminal emulator via OSC 52. This is a problem if one would like to use different shortcuts to copy into the tmux buffer and into the system clipboard by using OSC 52, without these two behaviours overlapping with each other.

Solutions

Two possible solutions to tackle this issue:

  1. Provide a different configuration options to manage OSC 52 security vs the option used to determine if copied data should be automatically sent via OSC 52. Unfortunately right now, setting set-clipboard to off, also means that copy-pipe is not able to send OSC 52 messages to the terminal emulator. The most backwards compatible solution would probably be to create a new config option, for example called send-to-clipboard and have it on by default. This setting would determine if tmux should send copied data to the clipboard regardless of security level. This would ensure existing configurations continue working as they currently do.
  2. Provide an alternative to copy-selection and copy-selection-and-cancel etc (e.g. copy-selection-no-send ?). These new commands would copy a selection to the tmux buffer but not send it onto the clipboard.

Required information

nicm commented 1 month ago

I'd say add a flag to copy-selection and friends (like -o for next-prompt) which skips setting the clipboard.

hetmankp commented 1 month ago

Yes I like that better than option no. 2. Is this something you'd like to see a pull request for?

nicm commented 1 month ago

It would certainly help :-).

hetmankp commented 1 month ago

Great, I'll try to take a look at this soon.

github-actions[bot] commented 5 days ago

This issue has been automatically locked since there has not been any recent activity after it was closed.