/clip-io

Package agnostic shim for piping stdout into clipboard and printing clipboard to stdout

Primary LanguageShellBSD Zero Clause License0BSD

clip-io

A package agnostic shim for piping stdout into clipboard and printing clipboard to stdout.

printf '%s\n' 'hello' | clip-in; clip-out
# stdout: hello

Dependencies

clip-io uses the following dependencies according to the environment:

X11: 
  - xclip | xsel 

Wayland:
  - wl-copy 
  - wl-paste

Termux:
  - termux-clipboard-set
  - termux-clipboard-get

Note:

termux-clipboard-{get,set} will hang unless the Termux:API addon is installed.

Examples

# Write clipboard to a file
clip-out > clipboard.txt

# Pipe a command into clipboard
date | clip-in

# Pipe a heredoc into clipboard removing trailing newlines
clip-in -r <<-'EOF'
	hello for a heredoc
EOF

License

Licensed under Zero-Clause BSD (0BSD). See LICENSE for details.