From a2bd19018bda355a84640a75a5e86111a5c90156 Mon Sep 17 00:00:00 2001 From: j <74ef54cf@opayq.com> Date: Sat, 12 Aug 2017 15:31:34 -0700 Subject: [PATCH] add termux commands to clipboard.zsh --- lib/clipboard.zsh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 2c93d1bb..68add6ce 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -30,6 +30,17 @@ function clipcopy() { else cat $file > /dev/clipboard fi + elif [[ $OSTYPE == linux-android ]]; then + if (( $+commands[termux-clipboard-set] )); then + if [[ -z $file ]]; then + termux-clipboard-set + else + cat "$file" | termux-clipboard-set + fi + else + print "clipcopy: termux-api not installed: https://github.com/termux/termux-api-package" >&2 + return 1 + fi else if (( $+commands[xclip] )); then if [[ -z $file ]]; then @@ -73,13 +84,20 @@ function clippaste() { pbpaste elif [[ $OSTYPE == cygwin* ]]; then cat /dev/clipboard + elif [[ $OSTYPE == linux-android ]]; then + if (( $+commands[termux-clipboard-get] )); then + termux-clipboard-get + else + print "clippaste: termux-api not installed: https://github.com/termux/termux-api-package" >&2 + return 1 + fi else if (( $+commands[xclip] )); then xclip -out -selection clipboard elif (( $+commands[xsel] )); then xsel --clipboard --output else - print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 + print "clippaste: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 return 1 fi fi