Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions rofi-pass
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ USERNAME_field='user'
AUTOTYPE_field='autotype'
OTPmethod_field='otp_method'

# Display these fields with entries.
# NOTE: no default here, handled in code.
SHOWFIELDS_field='showfields'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo? Shouldn't that be show_fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's the name in the entry, i.e. you can have showfields: autotype to only get "autotype" in the dialog.
show_fields is the var that rofi-pass uses to display them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the documentation accordingly, as it makes it easier to grasp the concept 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do - waiting for some approval that this is good in general first.

It would go to README.md then, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, README.md is the documentation.


default_autotype="user :tab pass"
delay=2
wait=0.2
Expand Down Expand Up @@ -495,9 +499,17 @@ typeMenu () {
if [[ -n $default_do ]]; then
if [[ $default_do == "menu" ]]; then
checkIfPass
local -a keys=("${!stuff[@]}")
keys=("${keys[@]/$AUTOTYPE_field}")
typefield=$({ printf '%s' "${AUTOTYPE_field}" ; printf '%s\n' "${keys[@]}" | sort; } | _rofi -dmenu -p "Choose Field to type > ")

local show_fields
if [[ -z "${stuff[$SHOWFIELDS_field]}" ]]; then
local -a keys=("${!stuff[@]}")
keys=("${keys[@]/$AUTOTYPE_field}")
declare -p keys stuff
show_fields=$(printf '%s' "${AUTOTYPE_field}" ; printf '%s\n' "${keys[@]}" | sort)
else
show_fields=$(printf '%s\n' "${stuff["$SHOWFIELDS_field"]}")
fi
typefield=$(echo "$show_fields" | _rofi -dmenu -p "Choose Field to type > ")
typefield_exit=$?
if [[ $typefield_exit -eq 1 ]]; then
exit
Expand Down