From a2acca731dfa0b7cd5df265796e6400d36fddb17 Mon Sep 17 00:00:00 2001 From: Patrik Cyvoct Date: Fri, 18 Jan 2019 17:48:41 +0100 Subject: Add path autotype feature Signed-off-by: Patrik Cyvoct --- README.md | 8 ++++++++ rofi-pass | 1 + 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 0c19053..c773700 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,14 @@ in a convenient way using [rofi](https://github.com/DaveDavenport/rofi). url: http://my.url.foo ``` +* Auto-typing username based on path. + The structure of your password store must be like: + + ``` + foo/bar/site.com/username + ``` + And you must set the `default-autotype` to `'path :tab pass'`. + * Auto-typing of more than one field, using the `autotype` entry: ``` diff --git a/rofi-pass b/rofi-pass index df1cff8..48928db 100755 --- a/rofi-pass +++ b/rofi-pass @@ -95,6 +95,7 @@ autopass () { ":enter") xdotool key Return;; ":otp") printf '%s' "$(generateOTP)" | xdotool type --delay ${xdotool_delay} --clearmodifiers --file -;; "pass") printf '%s' "${password}" | xdotool type --delay ${xdotool_delay} --clearmodifiers --file -;; + "path") printf '%s' "${selected_password}" | rev | cut -d'/' -f1 | rev | xdotool type --clearmodifiers --file -;; *) printf '%s' "${stuff[${word}]}" | xdotool type --delay ${xdotool_delay} --clearmodifiers --file -;; esac done -- cgit