extensible clipboard cli for wayland
Find a file
2024-08-20 18:25:51 +08:00
protocols wlsnarf: initial commit 2024-02-14 23:37:33 +08:00
snarfsrv snarfsrv: detect mimetype for file named '?' 2024-08-20 18:25:51 +08:00
wl-clipboard-shim snarfsrv: detect mimetype for file named '?' 2024-08-20 18:25:51 +08:00
arg.h wlsnarf: initial commit 2024-02-14 23:37:33 +08:00
Makefile Makefile: split up install,uninstall recipes 2024-03-17 23:11:52 +08:00
README README: update description, examples 2024-03-01 13:37:15 +08:00
wlsnarf.c wlsnarf: oflag check if data device matches 2024-03-11 14:41:00 +08:00

wlsnarf - extensible clipboard cli for wayland

usage:	wlsnarf [-s <seat>] [-p] [-o] ([-t <mimetype>]... -i <file>)...
	wlsnarf [-s <seat>] [-p] [-o] -w <cmd> <args>...
	wlsnarf [-s <seat>] [-p] -c

options:
-s SEAT	seat name
-p	use primary clipboard
-o	run for one offer only
-w CMD	spawn command for each offer with clipboard contents as stdin
	and mimetype appended to args
-c	clear clipboard
-t TYPE	specify mimetypes for file
-i FILE	source contents from file

description:
	wlsnarf is a highly extensible and scriptable clipboard manager that
	uses the wlr-data-control protocol.

	wlsnarf can set the clipboard contents by using the -t and -i flags to
	offer mimetypes for file sources.
	wlsnarf accepts any number of mimetypes before a file argument.
	if no mimetype is provided, a null string will be used.
	if no file is provided, stdin will be used.
	if file is a pipe, contents will only be served once. (see snarfsrv)

	clipboard contents are handled by passing a helper command to -w.
	wlsnarf watches for changes in clipboard contents, spawning a helper
	for each mimetype. the helper command can read the clipboard contents
	from stdin and the mimetype is appended to its command line.

examples:
	# copy stdin as plaintext to primary clipboard (serves only once)
	wlsnarf -p -t text/plain

	# copy screenshot as image/png and paste only once
	wlsnarf -o -t image/png -i <(grim -)

	# without process substitution
	grim - | wlsnarf -o -t image/png

	# copy README as both text and markdown
	wlsnarf -t text/plain -t text/markdown README

	# clear clipboard on seat0
	wlsnarf -s seat0 -c

	# list available mimetypes (like wl-paste -l)
	wlsnarf -o -w echo

	# watch available mimetypes on primary clipboard
	wlsnarf -p -w echo

	# paste clipboard contents matching mimetype
	wlsnarf -o -w sh -c '[ text/plain = "$1" ] && cat' -s

extras:
	# file server with persistence
	snarfsrv/snarfsrv

	# wl-clipboard drop-in replacements
	wl-clipboard-shim/wl-copy
	wl-clipboard-shim/wl-paste