X-Git-Url: https://git.ganneff.de//index.cgi?p=zsh.git;a=blobdiff_plain;f=.zsh%2F10_Environment.zsh;h=ea0709153862f5102a2cc2381d82e29e2157c1a1;hp=9ebd0c06b6cde119d90b4ee4bf9629cf1ce7c9df;hb=38c4a4ce936d3754a110df0f92b08dd7bca1a0f9;hpb=7e0bde4e2fcf580e627290da94dddc3b8ae3b366 diff --git a/.zsh/10_Environment.zsh b/.zsh/10_Environment.zsh index 9ebd0c0..ea07091 100644 --- a/.zsh/10_Environment.zsh +++ b/.zsh/10_Environment.zsh @@ -59,10 +59,27 @@ if [[ ${COLORS} == "true" ]]; then fi fi -(( ${+TMPDIR} )) || export TMPDIR="$HOME/tmp" +# User wants us to check if there is a tmpfs mounted for them +# (say /run/user/$uid), and if so, point TMPDIR there. We use +# a subdir there to avoid interfering with other stuff +if zstyle -T ':ganneff:config' runtmp; then + rudir="$(df -t tmpfs --output=target|grep ${UID} || true)/tmp" +fi + +# Ignore existing TMPDIR variable and always repoint... +if zstyle -T ':ganneff:config' resettmpdir; then + export TMPDIR="${rudir:-$HOME/tmp}" +else + # ... or not + (( ${+TMPDIR} )) || export TMPDIR="${rudir:-$HOME/tmp}" +fi + # Ensure the tmpdir exists mkdir -p ${TMPDIR} +# And adjust TMPPREFIX +export TMPPREFIX="${TMPDIR}/zsh" + # If its installed - use lesspipe (or maybe lessfile) if is-callable lesspipe; then if zstyle -t ':ganneff:config' lesstool lessfile; then