Created
February 2, 2019 19:01
-
-
Save schoettl/75addb5639308617554bdafeabd1c26f to your computer and use it in GitHub Desktop.
Copy text to both normal X clipboard and primary selection (middle mouse button)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note the -f option for xclip: | |
echo foo | xclip -f -i -selection clipboard | xclip -i -selection primary | |
# Short form: | |
echo foo | xclip -f -selection c | xclip | |
# Before I discovered xclip -f, I tried this which did not work in my Bash 5: | |
echo foo | tee >(xclip -i -selection clipboard) | xclip -i -selection primary | |
# Before that, I used this snippet: | |
declare tmp | |
tmp=$(mktemp) | |
echo foo > "$tmp" | |
xclip -selection c < "$tmp" | |
xclip -selection p < "$tmp" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment