[gopass] Add fall-back to dmenu if rofi not found

This commit is contained in:
Marty Oehme 2020-05-16 08:45:23 +02:00
parent d5bc2aeab5
commit 6100215c72
No known key found for this signature in database
GPG key ID: 0CCB0526EFB9611A
2 changed files with 12 additions and 5 deletions

View file

@ -2,11 +2,18 @@
#
# Original inspiration from https://github.com/carnager/rofi-pass/
# rofi wrapper. Add custom settings here.
# selector wrapper
# uses rofi if found, or dmenu if found, complains if no selector available
_rofi() {
# TODO add check for dmenu
exist rofi critical "rofi-gopass" || exit 0
rofi -dmenu -no-auto-select -i "$@" -p "Entry"
if type rofi 2>/dev/null; then
echo "rofi found" 1>&2
rofi -dmenu -no-auto-select -i "$@" -p "Entry"
elif type dmenu 2>/dev/null; then
echo "dmenu found" 1>&2
dmenu -i "$@" -p "Entry"
else
exist rofi critical "rofi-gopass" || exit 0
fi
}
# parse, see https://unix.stackexchange.com/a/331965/8541