Skip to content

Commit 35fd1f2

Browse files
author
Lars Wilke
committed
Use TMPDIR, if available, for storing recover_keys file.
1 parent 3289718 commit 35fd1f2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

scripts/copycat_mode_bindings.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extend_key() {
3030
fi
3131
# We save the previous mapping to a file in order to be able to recover
3232
# the previous mapping when we unbind
33-
tmux list-keys -T $(tmux_copy_mode_string) | $AWK_CMD '$4 == "'$key'"' >> /tmp/copycat_$(whoami)_recover_keys
33+
tmux list-keys -T $(tmux_copy_mode_string) | $AWK_CMD '$4 == "'$key'"' >> "${TMPDIR:-/tmp}/copycat_$(whoami)_recover_keys"
3434
tmux bind-key -T $(tmux_copy_mode_string) "$key" run-shell "tmux $cmd; $script; true"
3535
}
3636

scripts/copycat_mode_quit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ unbind_prev_next_bindings() {
1818
}
1919

2020
unbind_all_bindings() {
21-
grep -v copycat </tmp/copycat_$(whoami)_recover_keys | while read key_cmd; do
21+
grep -v copycat <"${TMPDIR:-/tmp}/copycat_$(whoami)_recover_keys" | while read key_cmd; do
2222
sh -c "tmux $key_cmd"
2323
done < /dev/stdin
24-
rm /tmp/copycat_$(whoami)_recover_keys
24+
rm "${TMPDIR:-/tmp}/copycat_$(whoami)_recover_keys"
2525
}
2626

2727
main() {

0 commit comments

Comments
 (0)