owenrusk.dev

dotfiles

shell, editor, ssh.

git clone https://owenrusk.dev/dotfiles.git

commit 4a45fe0da9388281468e58fd0e92c51f71d9328e
parent 371936e023b495d260d75cd3cc3d15bfd3f07241
author Owen Rusk <owen@papermothgames.com>
date   2024-06-06 16:40:12 -0500
bin: clip
bin/clip+9-0
diff --git a/bin/clip b/bin/clip
new file mode 100755
index 0000000..1bf7968
--- /dev/null
+++ b/bin/clip
@@ -0,0 +1,9 @@
+#!/bin/sh
+# stdin to the clipboard, with whatever this machine has
+if [ -n "${WAYLAND_DISPLAY:-}" ] && command -v wl-copy >/dev/null 2>&1; then
+    exec wl-copy
+elif [ -n "${DISPLAY:-}" ] && command -v xclip >/dev/null 2>&1; then
+    exec xclip -selection clipboard
+fi
+echo "clip: no clipboard here" >&2
+exit 1