remove accidently pushed changes

This commit is contained in:
Rasmus Steinke 2016-11-08 01:31:37 +01:00
parent f20750f6ba
commit cb95c34339

147
rofi-pass
View File

@ -75,21 +75,10 @@ autopass () {
chmod 600 "$HOME/.cache/rofi-pass/last_used"
if [[ -z "${stuff["$AUTOTYPE_field"]}" ]]; then
if [[ "${stuff["${USERNAME_field}"]}" ]]; then
if [[ $failsafe == "false" ]]; then
echo -n "${stuff["${USERNAME_field}"]}" | xdotool type --clearmodifiers --file -
elif [[ $failsafe == "true" ]]; then
echo -n "${stuff["${USERNAME_field}"]}" | xclip -sel clip
xdotool key "ctrl+v"
fi
echo -n "${stuff["${USERNAME_field}"]}" | xdotool type --clearmodifiers --file -
xdotool key Tab
fi
if [[ $failsafe == "false" ]]; then
echo -n "${password}" | xdotool type --clearmodifiers --file -
elif [[ $failsafe == "true" ]]; then
echo -n "${stuff["${USERNAME_field}"]}" | xclip -sel clip
xdotool key "ctrl+v"
fi
echo -n "${password}" | xdotool type --clearmodifiers --file -
sleep 1
if [[ ${auto_enter} == "true" ]]; then
xdotool key Return
@ -105,19 +94,9 @@ autopass () {
elif [[ $word == ":enter" ]]; then
xdotool key Return;
elif [[ $word == "pass" ]]; then
if [[ $failsafe == "false" ]]; then
echo -n "${password}" | xdotool type --clearmodifiers --file -
elif [[ $failsafe == "true" ]]; then
echo -n "${password}" | xclip -sel clip
xdotool key "ctrl+v"
fi
echo -n "${password}" | xdotool type --clearmodifiers --file -
else
if [[ $failsafe == "false" ]]; then
echo -n "${stuff[${word}]}" | xdotool type --clearmodifiers --file -
elif [[ $failsafe == "true" ]]; then
echo -n "${stuff[${word}]}" | xclip -sel clip
xdotool key "ctrl+v"
fi
echo -n "${stuff[${word}]}" | xdotool type --clearmodifiers --file -
fi
done
if [[ ${auto_enter} == "true" ]]; then
@ -189,6 +168,11 @@ copyPass () {
$(sleep 45; echo -n "" | xclip; echo "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") &
}
viewEntry () {
checkIfPass
showEntry "${selected_password}"
}
generatePass () {
askGen () {
askGenMenu=$(echo -e "Yes\nNo" | rofi -dmenu -p "Generate new Password for ${selected_password}? > ")
@ -242,7 +226,7 @@ mainMenu () {
HELP="Welcome to rofi-pass. Use <span color='$help_color'>${insert_pass}</span> to create a new pass entry.
Run ${default_do} with <span color='$help_color'>Enter</span>. For more help hit <span color='$help_color'>${help}</span>."
selected_password="$(list_passwords 2>/dev/null \
| _rofi \
| _rofi -mesg "${HELP}" \
-dmenu -kb-accept-entry '!Return' -kb-custom-1 "${autotype}" \
-kb-custom-2 "${type_user}" \
-kb-custom-3 "${type_pass}" \
@ -257,7 +241,6 @@ Run ${default_do} with <span color='$help_color'>Enter</span>. For more help hit
-kb-custom-16 "${help}" \
-kb-custom-17 "${switch}" \
-kb-custom-18 "${insert_pass}" \
-kb-custom-19 "Alt-g" \
-dmenu \
-select "$entry" \
-p "rofi-pass > ")"
@ -301,7 +284,7 @@ Run ${default_do} with <span color='$help_color'>Enter</span>. For more help hit
elif [[ "${rofi_exit}" -eq 11 ]]; then sleep 0.2; typeUser;
elif [[ "${rofi_exit}" -eq 12 ]]; then sleep 0.2; typePass;
elif [[ "${rofi_exit}" -eq 17 ]]; then copyURL;
elif [[ "${rofi_exit}" -eq 16 ]]; then export pass_content="${pass_content}"; showEntry;
elif [[ "${rofi_exit}" -eq 16 ]]; then viewEntry;
elif [[ "${rofi_exit}" -eq 18 ]]; then export default_do="menu"; typeMenu;
elif [[ "${rofi_exit}" -eq 15 ]]; then copyPass;
elif [[ "${rofi_exit}" -eq 23 ]]; then actionMenu;
@ -309,16 +292,10 @@ Run ${default_do} with <span color='$help_color'>Enter</span>. For more help hit
elif [[ "${rofi_exit}" -eq 24 ]]; then copyMenu;
elif [[ "${rofi_exit}" -eq 26 ]]; then $(${basecommand} --bmarks);
elif [[ "${rofi_exit}" -eq 27 ]]; then insertPass;
elif [[ "${rofi_exit}" -eq 28 ]]; then unlock_database;
fi
clearUp
}
unlock_database() {
_rofi -dmenu -p "Enter passphrase to unlock pass db: " -password | gpg -s --passphrase-fd 0
mainMenu
}
clearUp () {
password=''
@ -328,7 +305,6 @@ clearUp () {
unset selected_password
unset password_temp
unset stuff
echo -n "" | xclip -sel clip
}
helpMenu () {
@ -413,68 +389,53 @@ actionMenu () {
}
showEntry () {
entry=$(echo "${pass_content}" | _rofi -dmenu -p "content of '${selected_password}'")
if [[ -z $pass_content ]]; then
password_temp=$(PASSWORD_STORE_DIR="${root}" pass "$selected_password")
password="${password_temp%%$'\n'*}"
pass_key_value=$(echo "${password_temp}" | tail -n+2 | grep ': ')
declare -A stuff
while read -r LINE; do
_id="${LINE%%: *}"
_val="${LINE#* }"
stuff["${_id}"]=${_val}
done < <(echo "${pass_key_value}")
stuff["pass"]=${password}
if test "${stuff['autotype']+autotype}"
then
:
else
stuff["autotype"]="${USERNAME_field} :tab pass"
fi
pass_content="$(for key in "${!stuff[@]}"; do echo "${key}: ${stuff[$key]}"; done)"
fi
HELP="<span color='${help_color}'>${copy_entry}: Copy Entry</span>"
bla=$(echo -e "< Return\n${pass_content}" | _rofi -kb-accept-entry '!Return' -dmenu -mesg "Enter: Copy entry to clipboard" -p "> ")
rofi_exit=$?
if [[ $rofi_exit -eq 1 ]];
then
word=$(echo "$bla" | gawk -F': ' '{print $1}')
if [[ ${rofi_exit} -eq 1 ]]; then
exit
elif [[ ${rofi_exit} -eq 0 ]]; then
if [[ ${bla} == "< Return" ]]; then
mainMenu
else
if [[ -z $(echo -n "${stuff[${word}]}") ]]; then
echo -n "$word" | doClip
else
echo -n "${stuff[${word}]}" | doClip
fi
notify-send "rofi-pass" "Copied Password\nClearing in 45 seconds"
$(sleep 45; echo -n "" | xclip; echo "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") &
exit
fi
fi
if [[ $rofi_exit -eq 0 ]]; then
echo -n "${entry}" | doClip
notify-send "rofi-pass" "Copied Password\nClearing in 45 seconds"
$(sleep 45; echo -n "" | xclip; echo "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") &
fi
# if [[ -z $pass_content ]]; then
# password_temp=$(PASSWORD_STORE_DIR="${root}" pass "$selected_password")
# password="${password_temp%%$'\n'*}"
# pass_key_value=$(echo "${password_temp}" | tail -n+2 | grep ': ')
# declare -A stuff
# while read -r LINE; do
# _id="${LINE%%: *}"
# _val="${LINE#* }"
# stuff["${_id}"]=${_val}
# done < <(echo "${pass_key_value}")
# stuff["pass"]=${password}
# if test "${stuff['autotype']+autotype}"
# then
# :
# else
# stuff["autotype"]="${USERNAME_field} :tab pass"
# fi
# pass_content="$(for key in "${!stuff[@]}"; do echo "${key}: ${stuff[$key]}"; done)"
# fi
# HELP="<span color='${help_color}'>${copy_entry}: Copy Entry</span>"
# bla=$(echo -e "< Return\n${pass_content}" | _rofi -kb-accept-entry '!Return' -dmenu -mesg "Enter: Copy entry to clipboard" -p "> ")
# rofi_exit=$?
#
# word=$(echo "$bla" | gawk -F': ' '{print $1}')
# if [[ ${rofi_exit} -eq 1 ]]; then
# exit
# elif [[ ${rofi_exit} -eq 0 ]]; then
# if [[ ${bla} == "< Return" ]]; then
# mainMenu
# else
# if [[ -z $(echo -n "${stuff[${word}]}") ]]; then
# echo -n "$word" | doClip
# else
# echo -n "${stuff[${word}]}" | doClip
# fi
# notify-send "rofi-pass" "Copied Password\nClearing in 45 seconds"
# $(sleep 45; echo -n "" | xclip; echo "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") &
# exit
# fi
# fi
# exit
# unset stuff
# unset password
# unset selected_password
# unset password_temp
# unset stuff
# exit
exit
unset stuff
unset password
unset selected_password
unset password_temp
unset stuff
exit
}
manageEntry () {