1
0
Fork 0

better rofi-pass password autoselection

This commit is contained in:
Massaki Archambault 2018-04-11 13:26:15 -04:00
parent 35642d98ac
commit 0b866e6c06
1 changed files with 10 additions and 4 deletions

View File

@ -4,9 +4,15 @@
# rofi command. Make sure to have "$@" as last argument # rofi command. Make sure to have "$@" as last argument
_rofi () { _rofi () {
domain="$(xdotool getactivewindow getwindowname | grep -Eo 'https?://\S+' | sed -E 's%^https?://(www.)?([a-zA-Z0-9\-\.]+).+%\2%')" domain="$(xdotool getactivewindow getwindowname | grep -Eo 'https?://\S+' | sed -E 's%^https?://(www.)?([a-zA-Z0-9\-\.]+).+%\2%')"
if [[ -n "$domain" ]]; then while true; do
if [[ "$(pass find "$domain" | wc -l)" -gt 1 ]]; then
extra_arg="-select $domain" extra_arg="-select $domain"
break
else
# we search the next domain level until we hit the TLD
domain="$(echo "$domain" | sed -E '/^[a-zA-Z0-0]*\./{s///;q}; //!q1')" || break
fi fi
done
rofi -i -no-auto-select $extra_arg "$@" rofi -i -no-auto-select $extra_arg "$@"
} }
@ -37,7 +43,7 @@ wait=0.2
EDITOR='gvim -f' EDITOR='gvim -f'
# Browser # Browser
#BROWSER='chromium' BROWSER='firefox'
## Misc settings ## Misc settings