diff options
author | Rasmus Steinke <rasi@xssn.at> | 2016-02-16 00:10:12 +0100 |
---|---|---|
committer | Rasmus Steinke <rasi@xssn.at> | 2016-02-16 00:10:12 +0100 |
commit | de700a7255c2781b1176b199cc207ff3edea0389 (patch) | |
tree | 32bb6175b6730eb852c5928c3215f67323a8f1e7 | |
parent | 1ea7eb838189868ab1d0fe9c094520e3bdbcad83 (diff) | |
download | rofi-pass-de700a7255c2781b1176b199cc207ff3edea0389.tar.gz |
use /tmp for last-used, fixes #26
-rwxr-xr-x | rofi-pass | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -28,8 +28,8 @@ checkIfPass () { if [[ $selected_password == "[ Add Entry ]>" ]]; then mainMenu; elif [[ $selected_password == "---" ]]; then mainMenu; else - rm -f "$HOME/.config/rofi-pass/last_used" - echo "${root}: $selected_password" > "$HOME/.config/rofi-pass/last_used" + rm -f "/tmp/$USER-rofi-pass/last_used" + echo "${root}: $selected_password" > "/tmp/$USER-rofi-pass/last_used" fi } @@ -38,8 +38,8 @@ autopass () { if [[ ${selected_password} == "[ Add Entry ]>" ]]; then insertPass; elif [[ ${selected_password} == "---" ]]; then mainMenu; else - rm -f "$HOME/.config/rofi-pass/last_used" - echo "${root}: $selected_password" > "$HOME/.config/rofi-pass/last_used" + rm -f "/tmp/$USER-rofi-pass/last_used" + echo "${root}: $selected_password" > "/tmp/$USER-rofi-pass/last_used" if [[ -z "${stuff["$AUTOTYPE_field"]}" ]]; then echo -n "${stuff["${USERNAME_field}"]}" | xdotool type --clearmodifiers --file - xdotool key Tab @@ -493,6 +493,11 @@ if [[ -f $HOME/.config/rofi-pass/config ]]; then source $HOME/.config/rofi-pass/config fi +# create tmp dir +if [[ ! -d /tmp/$USER-rofi-pass ]]; then + mkdir /tmp/$USER-rofi-pass +fi + # set help color if [[ $help_color == "" ]]; then help_color=$(rofi -dump-xresources | grep 'rofi.color.normal' | awk -F ', ' '{ print $2 }') @@ -510,7 +515,7 @@ fi # check if alternative root directory was given on commandline if [[ $1 == "--last-used" || $1 == "--show-last" ]]; then - export root=$(awk -F ': ' '{ print $1 }' $HOME/.config/rofi-pass/last_used) + export root=$(awk -F ': ' '{ print $1 }' /tmp/$USER-rofi-pass/last_used) elif [[ -n "$2" && "$1" == "--root" ]]; then export root="${2}" elif [[ -n $root ]]; then @@ -535,10 +540,10 @@ export PASSWORD_STORE_DIR="${root}" help_msg ;; --last-used) - entry="$(awk -F ': ' '{ print $2 }' $HOME/.config/rofi-pass/last_used)" mainMenu + entry="$(awk -F ': ' '{ print $2 }' /tmp/$USER-rofi-pass/last_used)" mainMenu ;; --show-last) - selected_password="$(awk -F ': ' '{ print $2 }' $HOME/.config/rofi-pass/last_used)" showEntry + selected_password="$(awk -F ': ' '{ print $2 }' /tmp/$USER-rofi-pass/last_used)" showEntry ;; --bmarks) mainMenu --bmarks; |