commit 6e1fa67d508b1a20db9d62f7504c305f49640a54 parent ff70907c2da3afbb4e657d22bddd6dc4ab800560 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Sun, 10 Mar 2019 07:48:38 +0100 Rename copy script Diffstat:
A | links/.config/nnn/copy-selection-to-clipboard.sh | | | 32 | ++++++++++++++++++++++++++++++++ |
D | links/.config/nnn/copy-to-clipboard.sh | | | 18 | ------------------ |
2 files changed, 32 insertions(+), 18 deletions(-)
diff --git a/links/.config/nnn/copy-selection-to-clipboard.sh b/links/.config/nnn/copy-selection-to-clipboard.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env sh + +# Description: Copy paths of selection to clipboard +# +# Shell: generic +# Author: Arun Prakash Jana + +# Linux +f="$(xargs -0 < ~/.nnncp)" +#extension=$(echo "${f##*.}" | awk '{print tolower($0)') +mimetype=$(file --mime-type -Lb "$f") + +case "$mimetype" in + image/*) + xclip -selection clipboard -t "$mimetype" < "$f" + ;; + *) + # otherwise copy path to clipboard + echo "$f" | xclip -i -selection clipboard + ;; +esac + + + +# macOS +# cat ~/.nnncp | xargs -0 | pbcopy + +# Termux +# cat /data/data/com.termux/files/home/.nnncp | xargs -0 | termux-clipboard-set + +# Cygwin +# cat ~/.nnncp | xargs -0 | clip diff --git a/links/.config/nnn/copy-to-clipboard.sh b/links/.config/nnn/copy-to-clipboard.sh @@ -1,18 +0,0 @@ -#!/usr/bin/env sh - -# Description: Copy selection to clipboard -# -# Shell: generic -# Author: Arun Prakash Jana - -# Linux -cat ~/.nnncp | xargs -0 | xsel -bi - -# macOS -# cat ~/.nnncp | xargs -0 | pbcopy - -# Termux -# cat /data/data/com.termux/files/home/.nnncp | xargs -0 | termux-clipboard-set - -# Cygwin -# cat ~/.nnncp | xargs -0 | clip