wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.28k stars 781 forks source link

Clipboard hook support like tmux #1984

Closed kohnish closed 2 years ago

kohnish commented 2 years ago

Tmux supports clipboard hook something like this. Which set action when clipboard copy event happens.

set-hook -g 'pane-set-clipboard' "run-shell '(tmux show-buffer | wl-x11-pb-copy)'"

It is especially useful for osc52 yank on vim where it's not compiled with clipboard support with something like this. (if wezterm supports osc52 like tmux does)

autocmd TextYankPost * call system("printf $'\\e]52;c;%s\\a' \"$(base64 <<(</dev/stdin))\" >> /dev/tty", v:event.regcontents)
wez commented 2 years ago

What are you trying to do exactly? OSC 52 populates the clipboard already

kohnish commented 2 years ago

I'm trying to trigger these two commands on osc 52 event.

    echo -n "$stdin" | wl-copy
    echo -n "$stdin" | wl-copy -p

But nothing happens. This is the example command which works on tmux.

printf $'\e]52;c;%s\a' "$(base64 <<<'test_str')" >> /dev/tty
kohnish commented 2 years ago

Sorry, I was assuming that shift-insert works by default. This solved the issue.

{key = "Insert", mods = "SHIFT", action=wezterm.action{PasteFrom = "Clipboard"}},
github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.