remove column dep
This commit is contained in:
parent
ade93e8b72
commit
f20750f6ba
135
rofi-pass
135
rofi-pass
@ -75,10 +75,21 @@ autopass () {
|
|||||||
chmod 600 "$HOME/.cache/rofi-pass/last_used"
|
chmod 600 "$HOME/.cache/rofi-pass/last_used"
|
||||||
if [[ -z "${stuff["$AUTOTYPE_field"]}" ]]; then
|
if [[ -z "${stuff["$AUTOTYPE_field"]}" ]]; then
|
||||||
if [[ "${stuff["${USERNAME_field}"]}" ]]; then
|
if [[ "${stuff["${USERNAME_field}"]}" ]]; then
|
||||||
|
if [[ $failsafe == "false" ]]; then
|
||||||
echo -n "${stuff["${USERNAME_field}"]}" | xdotool type --clearmodifiers --file -
|
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
|
||||||
xdotool key Tab
|
xdotool key Tab
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $failsafe == "false" ]]; then
|
||||||
echo -n "${password}" | xdotool type --clearmodifiers --file -
|
echo -n "${password}" | xdotool type --clearmodifiers --file -
|
||||||
|
elif [[ $failsafe == "true" ]]; then
|
||||||
|
echo -n "${stuff["${USERNAME_field}"]}" | xclip -sel clip
|
||||||
|
xdotool key "ctrl+v"
|
||||||
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
if [[ ${auto_enter} == "true" ]]; then
|
if [[ ${auto_enter} == "true" ]]; then
|
||||||
xdotool key Return
|
xdotool key Return
|
||||||
@ -94,9 +105,19 @@ autopass () {
|
|||||||
elif [[ $word == ":enter" ]]; then
|
elif [[ $word == ":enter" ]]; then
|
||||||
xdotool key Return;
|
xdotool key Return;
|
||||||
elif [[ $word == "pass" ]]; then
|
elif [[ $word == "pass" ]]; then
|
||||||
|
if [[ $failsafe == "false" ]]; then
|
||||||
echo -n "${password}" | xdotool type --clearmodifiers --file -
|
echo -n "${password}" | xdotool type --clearmodifiers --file -
|
||||||
|
elif [[ $failsafe == "true" ]]; then
|
||||||
|
echo -n "${password}" | xclip -sel clip
|
||||||
|
xdotool key "ctrl+v"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
|
if [[ $failsafe == "false" ]]; then
|
||||||
echo -n "${stuff[${word}]}" | xdotool type --clearmodifiers --file -
|
echo -n "${stuff[${word}]}" | xdotool type --clearmodifiers --file -
|
||||||
|
elif [[ $failsafe == "true" ]]; then
|
||||||
|
echo -n "${stuff[${word}]}" | xclip -sel clip
|
||||||
|
xdotool key "ctrl+v"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [[ ${auto_enter} == "true" ]]; then
|
if [[ ${auto_enter} == "true" ]]; then
|
||||||
@ -168,11 +189,6 @@ copyPass () {
|
|||||||
$(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") &
|
||||||
}
|
}
|
||||||
|
|
||||||
viewEntry () {
|
|
||||||
checkIfPass
|
|
||||||
showEntry "${selected_password}"
|
|
||||||
}
|
|
||||||
|
|
||||||
generatePass () {
|
generatePass () {
|
||||||
askGen () {
|
askGen () {
|
||||||
askGenMenu=$(echo -e "Yes\nNo" | rofi -dmenu -p "Generate new Password for ${selected_password}? > ")
|
askGenMenu=$(echo -e "Yes\nNo" | rofi -dmenu -p "Generate new Password for ${selected_password}? > ")
|
||||||
@ -226,7 +242,7 @@ mainMenu () {
|
|||||||
HELP="Welcome to rofi-pass. Use <span color='$help_color'>${insert_pass}</span> to create a new pass entry.
|
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>."
|
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 \
|
selected_password="$(list_passwords 2>/dev/null \
|
||||||
| _rofi -mesg "${HELP}" \
|
| _rofi \
|
||||||
-dmenu -kb-accept-entry '!Return' -kb-custom-1 "${autotype}" \
|
-dmenu -kb-accept-entry '!Return' -kb-custom-1 "${autotype}" \
|
||||||
-kb-custom-2 "${type_user}" \
|
-kb-custom-2 "${type_user}" \
|
||||||
-kb-custom-3 "${type_pass}" \
|
-kb-custom-3 "${type_pass}" \
|
||||||
@ -241,6 +257,7 @@ Run ${default_do} with <span color='$help_color'>Enter</span>. For more help hit
|
|||||||
-kb-custom-16 "${help}" \
|
-kb-custom-16 "${help}" \
|
||||||
-kb-custom-17 "${switch}" \
|
-kb-custom-17 "${switch}" \
|
||||||
-kb-custom-18 "${insert_pass}" \
|
-kb-custom-18 "${insert_pass}" \
|
||||||
|
-kb-custom-19 "Alt-g" \
|
||||||
-dmenu \
|
-dmenu \
|
||||||
-select "$entry" \
|
-select "$entry" \
|
||||||
-p "rofi-pass > ")"
|
-p "rofi-pass > ")"
|
||||||
@ -284,7 +301,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 11 ]]; then sleep 0.2; typeUser;
|
||||||
elif [[ "${rofi_exit}" -eq 12 ]]; then sleep 0.2; typePass;
|
elif [[ "${rofi_exit}" -eq 12 ]]; then sleep 0.2; typePass;
|
||||||
elif [[ "${rofi_exit}" -eq 17 ]]; then copyURL;
|
elif [[ "${rofi_exit}" -eq 17 ]]; then copyURL;
|
||||||
elif [[ "${rofi_exit}" -eq 16 ]]; then viewEntry;
|
elif [[ "${rofi_exit}" -eq 16 ]]; then export pass_content="${pass_content}"; showEntry;
|
||||||
elif [[ "${rofi_exit}" -eq 18 ]]; then export default_do="menu"; typeMenu;
|
elif [[ "${rofi_exit}" -eq 18 ]]; then export default_do="menu"; typeMenu;
|
||||||
elif [[ "${rofi_exit}" -eq 15 ]]; then copyPass;
|
elif [[ "${rofi_exit}" -eq 15 ]]; then copyPass;
|
||||||
elif [[ "${rofi_exit}" -eq 23 ]]; then actionMenu;
|
elif [[ "${rofi_exit}" -eq 23 ]]; then actionMenu;
|
||||||
@ -292,10 +309,16 @@ 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 24 ]]; then copyMenu;
|
||||||
elif [[ "${rofi_exit}" -eq 26 ]]; then $(${basecommand} --bmarks);
|
elif [[ "${rofi_exit}" -eq 26 ]]; then $(${basecommand} --bmarks);
|
||||||
elif [[ "${rofi_exit}" -eq 27 ]]; then insertPass;
|
elif [[ "${rofi_exit}" -eq 27 ]]; then insertPass;
|
||||||
|
elif [[ "${rofi_exit}" -eq 28 ]]; then unlock_database;
|
||||||
fi
|
fi
|
||||||
clearUp
|
clearUp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock_database() {
|
||||||
|
_rofi -dmenu -p "Enter passphrase to unlock pass db: " -password | gpg -s --passphrase-fd 0
|
||||||
|
mainMenu
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
clearUp () {
|
clearUp () {
|
||||||
password=''
|
password=''
|
||||||
@ -305,6 +328,7 @@ clearUp () {
|
|||||||
unset selected_password
|
unset selected_password
|
||||||
unset password_temp
|
unset password_temp
|
||||||
unset stuff
|
unset stuff
|
||||||
|
echo -n "" | xclip -sel clip
|
||||||
}
|
}
|
||||||
|
|
||||||
helpMenu () {
|
helpMenu () {
|
||||||
@ -389,53 +413,68 @@ actionMenu () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showEntry () {
|
showEntry () {
|
||||||
if [[ -z $pass_content ]]; then
|
entry=$(echo "${pass_content}" | _rofi -dmenu -p "content of '${selected_password}'")
|
||||||
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=$?
|
rofi_exit=$?
|
||||||
|
|
||||||
word=$(echo "$bla" | gawk -F': ' '{print $1}')
|
if [[ $rofi_exit -eq 1 ]];
|
||||||
if [[ ${rofi_exit} -eq 1 ]]; then
|
then
|
||||||
exit
|
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
|
fi
|
||||||
|
|
||||||
|
if [[ $rofi_exit -eq 0 ]]; then
|
||||||
|
echo -n "${entry}" | 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") &
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
exit
|
|
||||||
unset stuff
|
# if [[ -z $pass_content ]]; then
|
||||||
unset password
|
# password_temp=$(PASSWORD_STORE_DIR="${root}" pass "$selected_password")
|
||||||
unset selected_password
|
# password="${password_temp%%$'\n'*}"
|
||||||
unset password_temp
|
# pass_key_value=$(echo "${password_temp}" | tail -n+2 | grep ': ')
|
||||||
unset stuff
|
# declare -A stuff
|
||||||
exit
|
# 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
|
||||||
}
|
}
|
||||||
|
|
||||||
manageEntry () {
|
manageEntry () {
|
||||||
@ -467,7 +506,7 @@ manageEntry () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
listgpg () {
|
listgpg () {
|
||||||
find . -name \*.gpg -print | cut -c 3- | while read line; do echo -e "${line##*/}\t(In: ${line%%/*})"; done | sed 's/(.*.gpg)$//g; s/.gpg\t/\t/g' | column -s $'\t' -t
|
find . -type f -not -path '*/\.*' | cut -c 3-
|
||||||
}
|
}
|
||||||
|
|
||||||
insertPass () {
|
insertPass () {
|
||||||
|
Loading…
Reference in New Issue
Block a user