passrofi: Add wayland support (version 0.2.0)

This commit is contained in:
Lexi / Zoe 2025-12-22 20:34:38 +01:00
parent 0318d84a6e
commit 695985746e
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232

View file

@ -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