outsource pass checking in own function
This commit is contained in:
parent
b411e01304
commit
d5f3b25e38
42
rofi-pass
42
rofi-pass
@ -65,6 +65,13 @@ doClip () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkIfPass () {
|
||||||
|
if [[ $selected_password == "[ Add Entry ]>" ]]; then
|
||||||
|
mainMenu
|
||||||
|
elif [[ $selected_password == "[ Manage Database ]>" ]]; then
|
||||||
|
mainMenu
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# main Menu
|
# main Menu
|
||||||
mainMenu () {
|
mainMenu () {
|
||||||
@ -77,13 +84,25 @@ ${line2}</span>"
|
|||||||
rofi_exit=$?
|
rofi_exit=$?
|
||||||
|
|
||||||
if [[ -n $selected_password ]]; then
|
if [[ -n $selected_password ]]; then
|
||||||
rm -f "$HOME/.config/rofi-pass/last_used"
|
if [[ $selected_password != "[ Add Entry ]>" || $selected_password != "[ Manage Database ]>" ]]; then
|
||||||
echo "${root}: $selected_password" > "$HOME/.config/rofi-pass/last_used"
|
rm -f "$HOME/.config/rofi-pass/last_used"
|
||||||
|
echo "${root}: $selected_password" > "$HOME/.config/rofi-pass/last_used"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [[ "${rofi_exit}" -eq 0 ]]; then
|
||||||
if [[ "${rofi_exit}" -eq 13 ]]; then $BROWSER "$(pass "$selected_password" | grep "${URL_field}: " | awk '{sub(/:/,"")}{print $2}1' | head -1)"; exit;
|
if [[ ${selected_password} == "[ Add Entry ]>" ]]; then
|
||||||
|
insertPass
|
||||||
|
elif [[ ${selected_password} == "[ Manage Database ]>" ]]; then
|
||||||
|
manageMenu
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
elif [[ "${rofi_exit}" -eq 13 ]]; then
|
||||||
|
checkIfPass
|
||||||
|
$BROWSER "$(pass "$selected_password" | grep "${URL_field}: " | awk '{sub(/:/,"")}{print $2}1' | head -1)"; exit;
|
||||||
elif [[ "${rofi_exit}" -eq 1 ]]; then exit ${rofi_exit};
|
elif [[ "${rofi_exit}" -eq 1 ]]; then exit ${rofi_exit};
|
||||||
elif [[ "${rofi_exit}" -eq 10 || "${rofi-exit}" -eq 0 ]]; then true
|
elif [[ "${rofi_exit}" -eq 10 ]]; then
|
||||||
|
checkIfPass
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -98,28 +117,27 @@ ${line2}</span>"
|
|||||||
done < <(PASSWORD_STORE_DIR="${root}" pass "${selected_password}" | tail -n+2 | grep -P '(: |:\t)' )
|
done < <(PASSWORD_STORE_DIR="${root}" pass "${selected_password}" | tail -n+2 | grep -P '(: |:\t)' )
|
||||||
stuff["pass"]=${password}
|
stuff["pass"]=${password}
|
||||||
|
|
||||||
if [[ "$selected_password" == "[ Add Entry ]>" ]]; then
|
|
||||||
insertPass
|
|
||||||
elif [[ "$selected_password" == "[ Manage Database ]>" ]]; then
|
|
||||||
manageEntry
|
|
||||||
elif [[ "$selected_password" == "" ]]; then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
if [[ $rofi_exit -eq 11 ]]; then
|
if [[ $rofi_exit -eq 11 ]]; then
|
||||||
|
checkIfPass
|
||||||
echo -n "${stuff[${USERNAME_field}]}" | xdotool type --clearmodifiers --file -
|
echo -n "${stuff[${USERNAME_field}]}" | xdotool type --clearmodifiers --file -
|
||||||
exit
|
exit
|
||||||
elif [[ $rofi_exit -eq 12 ]]; then
|
elif [[ $rofi_exit -eq 12 ]]; then
|
||||||
|
checkIfPass
|
||||||
echo -n "${password}" | xdotool type --clearmodifiers --file -
|
echo -n "${password}" | xdotool type --clearmodifiers --file -
|
||||||
exit
|
exit
|
||||||
elif [[ $rofi_exit -eq 14 ]]; then
|
elif [[ $rofi_exit -eq 14 ]]; then
|
||||||
|
checkIfPass
|
||||||
echo -n "${stuff[${USERNAME_field}]}" | doClip
|
echo -n "${stuff[${USERNAME_field}]}" | doClip
|
||||||
exit
|
exit
|
||||||
elif [[ $rofi_exit -eq 17 ]]; then
|
elif [[ $rofi_exit -eq 17 ]]; then
|
||||||
|
checkIfPass
|
||||||
echo -n "${stuff[${URL_field}]}" | doClip
|
echo -n "${stuff[${URL_field}]}" | doClip
|
||||||
exit
|
exit
|
||||||
elif [[ $rofi_exit -eq 16 ]]; then
|
elif [[ $rofi_exit -eq 16 ]]; then
|
||||||
|
checkIfPass
|
||||||
showEntry "${selected_password}"
|
showEntry "${selected_password}"
|
||||||
elif [[ $rofi_exit -eq 15 ]]; then
|
elif [[ $rofi_exit -eq 15 ]]; then
|
||||||
|
checkIfPass
|
||||||
echo -n "$password" | doClip
|
echo -n "$password" | doClip
|
||||||
notify-send "rofi-pass" "Copied Password\nClearing in 45 seconds"
|
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") &
|
$(sleep 45; echo -n "" | xclip; echo "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") &
|
||||||
|
Loading…
x
Reference in New Issue
Block a user