No subject
Wu Zhenyu
wuzhenyu at ustc.edu
Thu Jan 19 09:18:45 UTC 2023
From: Wu Zhenyu <wuzhenyu at ustc.edu>
To: password-store at lists.zx2c4.com
Subject: [PATCH] feat: support more clippers
Date: Thu, 19 Jan 2023 17:18:44 +0800
Message-Id: <20230119091844.3148981-1-wuzhenyu at ustc.edu>
X-Mailer: git-send-email 2.39.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Refer https://github.com/neovim/neovim/blob/db407010facc55c19b5ebdf881225ac39cb29d01/runtime/autoload/provider/clipboard.vim#L69-L158
---
src/password-store.sh | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/password-store.sh b/src/password-store.sh
index 22e818f..64652f4 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -163,12 +163,35 @@ clip() {
paste_cmd+=( --primary )
fi
local display_name="$WAYLAND_DISPLAY"
- elif [[ -n $DISPLAY ]] && command -v xclip &> /dev/null; then
- local copy_cmd=( xclip -selection "$X_SELECTION" )
- local paste_cmd=( xclip -o -selection "$X_SELECTION" )
+ elif [[ -n $DISPLAY ]]; then
+ if command -v xsel &> /dev/null; then
+ local copy_cmd=( xsel -i "--$X_SELECTION" )
+ local paste_cmd=( xsel -o "--$X_SELECTION" )
+ elif command -v xclip &> /dev/null; then
+ local copy_cmd=( xclip -selection "$X_SELECTION" )
+ local paste_cmd=( xclip -o -selection "$X_SELECTION" )
+ fi
local display_name="$DISPLAY"
+ elif command -v pbcopy &> /dev/null; then
+ local copy_cmd=( pbcopy )
+ local paste_cmd=( pbpaste )
+ elif command -v lemonade &> /dev/null; then
+ local copy_cmd=( lemonade copy )
+ local paste_cmd=( lemonade paste )
+ elif command -v doitclient &> /dev/null; then
+ local copy_cmd=( doitclient wclip )
+ local paste_cmd=( doitclient wclip -r )
+ elif command -v win32yank &> /dev/null; then
+ local copy_cmd=( win32yank -i --crlf )
+ local paste_cmd=( win32yank -o --lf )
+ elif command -v termux-clipboard-set &> /dev/null; then
+ local copy_cmd=( termux-clipboard-set )
+ local paste_cmd=( termux-clipboard-get )
+ elif command -v tmux &> /dev/null; then
+ local copy_cmd=( tmux load-buffer - )
+ local paste_cmd=(tmux save-buffer - )
else
- die "Error: No X11 or Wayland display and clipper detected"
+ die "Error: No clipboard detected"
fi
local sleep_argv0="password store sleep on display $display_name"
--
2.39.0
More information about the Password-Store
mailing list