In the strange case that the user is jumping back and forth from X11 to Wayland and viceversa, xclip might be installed but wl-clip might not, and in such combination user might end up
with the -c opion not working.

https://bugzilla.opensuse.org/show_bug.cgi?id=1185984

---
 src/password-store.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index a0dcf2e..710f258 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -155,7 +155,7 @@ check_sneaky_paths() {
 #

 clip() {
-       if [[ -n $WAYLAND_DISPLAY ]]; then
+ if [[ -n $WAYLAND_DISPLAY ]] && command -v wl-copy > /dev/null; then
                local copy_cmd=( wl-copy )
                local paste_cmd=( wl-paste -n )
                if [[ $X_SELECTION == primary ]]; then
@@ -163,7 +163,7 @@ clip() {
                        paste_cmd+=( --primary )
                fi
                local display_name="$WAYLAND_DISPLAY"
-       elif [[ -n $DISPLAY ]]; then
+       elif [[ -n $DISPLAY ]] && command -v xclip > /dev/null; then
                local copy_cmd=( xclip -selection "$X_SELECTION" )
                local paste_cmd=( xclip -o -selection "$X_SELECTION" )
                local display_name="$DISPLAY"
--
2.31.1

Reply via email to