Skip to content

Commit

Permalink
Add Walyand support for copy functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonVanAssche committed Mar 14, 2023
1 parent 4d11461 commit 259504f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bashpass
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,11 @@ Show() {
# Copy the password that was given to the clipboard.
# Clear the clipboard afterwards.
Copy() {
# Detect 'xclip' or 'xsel'
# Detect 'xclip' (X11), 'xsel' (X11) or 'wl-clipboard' (Wayland).
commmand -v xclip &> /dev/null ||
command -v xsel &> /dev/null ||
Kill "xclip or xsel is required" "127"
command -v wl-copy &> /dev/null ||
Kill "xclip, xsel or wl-clipboard (Wayland) is required" "127"

# Ask for a name when no name was given using ${2}.
Name "${1}" "copy"
Expand All @@ -274,9 +275,12 @@ Copy() {
:
elif gpg --decrypt --quiet "${passLocation}/${name}.gpg" | xsel --clipboard 2> /dev/null; then
:
elif gpg --decrypt --quiet "${passLocation}/${name}.gpg" | wl-copy 2> /dev/null; then
:
else
command -v "xclip" &> /dev/null && xclip -selection clipboard < /dev/null
command -v "xsel" &> /dev/null && xsel --clipboard < /dev/null
command -v "wl-copy" &> /dev/null && wl-copy < /dev/null
Kill "failed to copy password '${name}' to the clipboard." "1"
fi

Expand Down

0 comments on commit 259504f

Please sign in to comment.