diff options
author | Rasmus Steinke <rasi@xssn.at> | 2016-07-16 16:59:53 +0200 |
---|---|---|
committer | Rasmus Steinke <rasi@xssn.at> | 2016-07-16 16:59:53 +0200 |
commit | cd8e18670e15d97b5a90edd7e7993f99bb100860 (patch) | |
tree | 029f201981170fa3a5cafe949d984a12ac85ffdc | |
parent | b6dcf56e9a15487915c1e6caccf066b1156213eb (diff) | |
download | rofi-pass-cd8e18670e15d97b5a90edd7e7993f99bb100860.tar.gz |
write temporary files to ~/.cache
-rwxr-xr-x | rofi-pass | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -33,8 +33,9 @@ checkIfPass () { elif [[ $selected_password == "---" ]]; then mainMenu; else - rm -f "/tmp/$USER-rofi-pass/last_used" - echo "${root}: $selected_password" > "/tmp/$USER-rofi-pass/last_used" + rm -f "$HOME/.cache/rofi-pass/last_used" + echo "${root}: $selected_password" > "$HOME/.cache/rofi-pass/last_used" + chmod 600 "$HOME/.cache/rofi-pass/last_used" fi } @@ -45,8 +46,9 @@ autopass () { elif [[ ${selected_password} == "---" ]]; then mainMenu; else - rm -f "/tmp/$USER-rofi-pass/last_used" - echo "${root}: $selected_password" > "/tmp/$USER-rofi-pass/last_used" + rm -f "$HOME/.cache/rofi-pass/last_used" + echo "${root}: $selected_password" > "$HOME/.cache/rofi-pass/last_used" + chmod 600 "$HOME/.cache/rofi-pass/last_used" if [[ -z "${stuff["$AUTOTYPE_field"]}" ]]; then if [[ "${stuff["${USERNAME_field}"]}" ]]; then echo -n "${stuff["${USERNAME_field}"]}" | xdotool type --clearmodifiers --file - @@ -498,8 +500,8 @@ if [[ -f "$HOME/.config/rofi-pass/config" ]]; then fi # create tmp dir -if [[ ! -d /tmp/$USER-rofi-pass ]]; then - mkdir "/tmp/$USER-rofi-pass" +if [[ ! -d $HOME/.cache/rofi-pass ]]; then + mkdir "$HOME/.cache/rofi-pass" fi # set help color @@ -517,8 +519,8 @@ if [[ -z ${count} ]]; then fi # check if alternative root directory was given on commandline -if [[ -r "/tmp/$USER-rofi-pass/last_used" ]] && [[ $1 == "--last-used" || $1 == "--show-last" ]]; then - export root; root=$(awk -F ': ' '{ print $1 }' "/tmp/$USER-rofi-pass/last_used") +if [[ -r "$HOME/.cache/rofi-pass/last_used" ]] && [[ $1 == "--last-used" || $1 == "--show-last" ]]; then + export root; root=$(awk -F ': ' '{ print $1 }' "$HOME/.cache/rofi-pass/last_used") elif [[ -n "$2" && "$1" == "--root" ]]; then export root="${2}" elif [[ -n $root ]]; then @@ -543,14 +545,14 @@ export PASSWORD_STORE_DIR="${root}" help_msg ;; --last-used) - if [[ -r "/tmp/$USER-rofi-pass/last_used" ]]; then - entry="$(awk -F ': ' '{ print $2 }' "/tmp/$USER-rofi-pass/last_used")" + if [[ -r "$HOME/.cache/rofi-pass/last_used" ]]; then + entry="$(awk -F ': ' '{ print $2 }' "$HOME/.cache/rofi-pass/last_used")" fi mainMenu ;; --show-last) - if [[ -r "/tmp/$USER-rofi-pass/last_used" ]]; then - selected_password="$(awk -F ': ' '{ print $2 }' "/tmp/$USER-rofi-pass/last_used")" showEntry + if [[ -r "$HOME/.cache/rofi-pass/last_used" ]]; then + selected_password="$(awk -F ': ' '{ print $2 }' "$HOME/.cache/rofi-pass/last_used")" showEntry else mainMenu fi |