From 695985746e964ee0d3160b15ef625f3d01e768c4 Mon Sep 17 00:00:00 2001 From: binaryDiv Date: Mon, 22 Dec 2025 20:34:38 +0100 Subject: [PATCH] passrofi: Add wayland support (version 0.2.0) --- bin/passrofi | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/bin/passrofi b/bin/passrofi index 7635003..5c57b5b 100755 --- a/bin/passrofi +++ b/bin/passrofi @@ -1,7 +1,7 @@ #!/bin/bash # passrofi -- Rofi script for pass (passwordstore.org) -# Version: 0.1.1 +# Version: 0.2.0 # Author: binaryDiv @@ -50,6 +50,15 @@ fail() { exit 1 } +# Copies a string to the clipboard +copy_to_clipboard() { + if [[ $XDG_SESSION_TYPE == "wayland" ]]; then + echo "$@" | wl-copy -n &>/dev/null + else + echo "$@" | xclip -selection clipboard -r -silent &>/dev/null + fi +} + # Main entrypoint # --------------- @@ -294,7 +303,7 @@ handle_copy_username() { # Copy to clipboard coproc ( - echo "$username" | xclip -selection clipboard -r -silent &>/dev/null + copy_to_clipboard "$username" ) # End here @@ -340,6 +349,11 @@ main "$@" # CHANGELOG # ========= # +# Version 0.2.0: +# +# - Add wayland support for copying the username to the clipboard. +# (Requires wl-copy from wl-clipboard.) +# # Version 0.1.1: # # - Use "view_in_terminal" to view a password file if an executable with that