From f17108a2d5c3299f92c610abda2c5e9e8bee2a64 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Tue, 1 Dec 2020 17:20:34 +0100 Subject: [PATCH] Add key binding to yank current entry to clipboard in Wayland. --- Examples.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Examples.md b/Examples.md index aacae81..a360e76 100644 --- a/Examples.md +++ b/Examples.md @@ -57,6 +57,7 @@ Table of Contents * [dotfiles management](#dotfiles-management) * [Transmission](#transmission) * [Pacman](#pacman) +* [Copy current item to clipboard](#clipboard) ### General @@ -1656,3 +1657,13 @@ function re() { yay -Qq | fzf -q "$1" -m --preview 'yay -Qi {1}' | xargs -ro yay -Rns } ``` + +### Clipboard +Uses [wl-copy](https://github.com/bugaevc/wl-clipboard) to copy the current entry to the clipboard on Wayland: + +```sh +export FZF_DEFAULT_OPTS='--bind "ctrl-y:execute-silent(printf {} | cut -f 2- | wl-copy --trim-newline)"' +``` + +This works with `execute-silent` but not with `execute`, presumably because `execute` waits for `wl-copy` to end. Appending a `&` did not change that. +