From 1f327d4a4ab30b95ee41e94bcb3efc60441304d7 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Tue, 9 Feb 2021 17:40:41 -0500 Subject: Add pbcopy, pbpaste, open dispatch scripts --- home/.local/bin/open | 18 ++++++++++++++++++ home/.local/bin/pbcopy | 11 +++++++++++ home/.local/bin/pbpaste | 11 +++++++++++ 3 files changed, 40 insertions(+) create mode 100755 home/.local/bin/open create mode 100755 home/.local/bin/pbcopy create mode 100755 home/.local/bin/pbpaste (limited to 'home') diff --git a/home/.local/bin/open b/home/.local/bin/open new file mode 100755 index 00000000..256a62e2 --- /dev/null +++ b/home/.local/bin/open @@ -0,0 +1,18 @@ +#!/bin/sh +set -eu + +if [ -n "${SSH_CLIENT:-}" ]; then + exec pbd -o "$@" +fi + +case "$1" in + (*.gif|*.jpeg|*.jpg|*.png) + curl -LSs "$1" | imv - + ;; + (*.txt) + exec xterm -hold -e sh -c 'curl -LSs "$1" | $PAGER' - "$1" + ;; + (*) + printf '%s' "$1" | pbcopy + ;; +esac diff --git a/home/.local/bin/pbcopy b/home/.local/bin/pbcopy new file mode 100755 index 00000000..a804f836 --- /dev/null +++ b/home/.local/bin/pbcopy @@ -0,0 +1,11 @@ +#!/bin/sh +set -eu + +if [ -n "${SSH_CLIENT:-}" ]; then + exec pbd -c +elif [ -n "${DISPLAY:-}" ]; then + exec xsel -bi +else + echo "${0}: don't know what to do" >&2 + exit 1 +fi diff --git a/home/.local/bin/pbpaste b/home/.local/bin/pbpaste new file mode 100755 index 00000000..2924f01e --- /dev/null +++ b/home/.local/bin/pbpaste @@ -0,0 +1,11 @@ +#!/bin/sh +set -eu + +if [ -n "${SSH_CLIENT:-}" ]; then + exec pbd -p +elif [ -n "${DISPLAY:-}" ]; then + exec xsel -bo +else + echo "${0}: don't know what to do" >&2 + exit 1 +fi -- cgit 1.4.1