aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/tessen.1.scd3
-rwxr-xr-xtessen8
2 files changed, 7 insertions, 4 deletions
diff --git a/man/tessen.1.scd b/man/tessen.1.scd
index bb08642..d5d6b0f 100644
--- a/man/tessen.1.scd
+++ b/man/tessen.1.scd
@@ -81,7 +81,8 @@ URI. However, if a key called 'password' is present, it will be ignored.
If a key called 'user' is present, its value will be the default username
instead of the basename of the selected file. This key can be modified using the
-*TESSEN_USERKEY* environment variable.
+*TESSEN_USERKEY* environment variable. If entries in password store use
+different keys for specifying user names regular expression can be used.
If a key called 'url' is present, an option to open the value of the 'url' key
in the default web browser will be shown instead of auto type. This becomes the
diff --git a/tessen b/tessen
index 726ebdc..82a5203 100755
--- a/tessen
+++ b/tessen
@@ -22,7 +22,8 @@ readonly -a tsn_known_backends=('bemenu' 'fuzzel' 'rofi' 'wofi')
tsn_backend="${TESSEN_BACKEND-}"
tsn_backend_opts=()
tsn_action="${TESSEN_ACTION-}"
-tsn_userkey="${TESSEN_USERKEY:-user}"
+tsn_userkey_regex="${TESSEN_USERKEY:-user}"
+tsn_userkey="user"
tsn_urlkey="${TESSEN_URLKEY:-url}"
tsn_autokey="${TESSEN_AUTOKEY:-autotype}"
tsn_autotype=""
@@ -85,8 +86,9 @@ get_pass_data() {
# keys with the case insensitive name 'password' are ignored
if [[ "${key,,}" == "password" ]]; then
continue
- elif [[ "${key,,}" == "$tsn_userkey" ]]; then
+ elif [[ -z "${tsn_username}" ]] && [[ "${key,,}" =~ ^${tsn_userkey_regex}$ ]]; then
tsn_username="$val"
+ tsn_userkey="${key,,}"
elif [[ "${key,,}" == "$tsn_autokey" ]]; then
tsn_autotype="$val"
elif [[ "$idx" =~ $otp_regex ]]; then
@@ -96,7 +98,7 @@ get_pass_data() {
fi
done
- # if $tsn_userkey isn't found, use the basename of file as username
+ # if $tsn_userkey_regex isn't found, use the basename of file as username
if [[ -z "$tsn_username" ]]; then
tsn_username="${tsn_passfile##*/}"
fi