diff --git a/bin/passrofi b/bin/passrofi index d4d3d69..7635003 100755 --- a/bin/passrofi +++ b/bin/passrofi @@ -1,7 +1,7 @@ #!/bin/bash # passrofi -- Rofi script for pass (passwordstore.org) -# Version: 0.1.0 +# Version: 0.1.1 # Author: binaryDiv @@ -311,10 +311,25 @@ handle_view_file() { # Open file in a pager inside a terminal coproc ( - rofi-sensible-terminal -e "bash -ic 'pass show \"$USER_SELECTION\" | less'" &>/dev/null + #rofi-sensible-terminal -e "bash -ic 'pass show \"$USER_SELECTION\" | less'" &>/dev/null + { + echo "Password file: $USER_SELECTION" + echo "------------------------------------------------------------" + pass show "$USER_SELECTION" + echo + } | view_stdin_in_terminal &>/dev/null ) } +# Opens a terminal that shows data from stdin. Uses 'view_in_terminal' if it exists in $PATH. +view_stdin_in_terminal() { + if which view_in_terminal &>/dev/null; then + view_in_terminal + else + rofi-sensible-terminal -e "bash -ic 'less < /proc/$BASHPID/fd/0'" + fi +} + # Run script main "$@" @@ -325,6 +340,11 @@ main "$@" # CHANGELOG # ========= # +# Version 0.1.1: +# +# - Use "view_in_terminal" to view a password file if an executable with that +# name exists in the PATH. +# # Version 0.1.0: # # - First version