summaryrefslogtreecommitdiff
path: root/.profile
diff options
context:
space:
mode:
Diffstat (limited to '.profile')
-rw-r--r--.profile51
1 files changed, 36 insertions, 15 deletions
diff --git a/.profile b/.profile
index 2d6f370..84103f3 100644
--- a/.profile
+++ b/.profile
@@ -13,24 +13,45 @@ umask 022
## Paths #############################################################
# Unix
-bins=($HOME/bin $HOME/.local.`uname -m`/bin $HOME/.local/bin $HOME/.prefix.`uname -m`/bin $HOME/.prefix/bin $HOME/.gem/ruby/*/bin)
-for dir in "${bins[@]}"; do
- if [ -d "$dir" ]; then
- export PATH="$dir:$PATH"
+prefixes=(
+ "$HOME"
+ "$HOME/.local.`uname -m`"
+ "$HOME/.local/bin"
+ "$HOME/.prefix.`uname -m`"
+ "$HOME/.prefix"
+ "$HOME"/.gem/ruby/*
+)
+for prefix in "${prefixes[@]}"; do
+ if [[ -d "$prefix/bin" ]]; then
+ export PATH="$prefix/bin:$PATH"
fi
done
# Ruby
-for dir in $HOME/.prefix/lib; do
- if [ -d "$dir" ]; then
+for dir in "$HOME"/.prefix/lib; do
+ if [[ -d "$dir" ]]; then
export RUBYLIB="$dir"
fi
done
+unset prefixes dir prefix
+
+# TMPDIR #############################################################
+
+if [[ ! -d "$HOME/tmp" ]]; then
+ tmp="$(mktemp --tmpdir -d "$USER-tmpdir.XXXXXXXXXXXXXXXXXXX")"
+ ln -sf "$tmp" "$HOME/tmp"
+ unset tmp
+fi
+export TMPDIR="$HOME/tmp"
+
+# XDG ################################################################
+
+. "$HOME/.local/lib/xdg.sh"
# Settings ###########################################################
# Text editor
-if [ -f "$HOME/.selected_editor" ]; then
+if [[ -f "$HOME/.selected_editor" ]]; then
. "$HOME/.selected_editor"
export SELECTED_EDITOR
export ALTERNATE_EDITOR
@@ -39,14 +60,14 @@ if [ -f "$HOME/.selected_editor" ]; then
fi
# GPG
-if [ -z "$GPGKEY" ] && [ -f "${HOME}/.gnupg/gpg.conf" ]; then
+if [[ -z $GPGKEY ]] && [[ -f "${HOME}/.gnupg/gpg.conf" ]]; then
export GPGKEY=`sed -nr 's/^\s*default-key\s+//p' "${HOME}/.gnupg/gpg.conf"`
fi
-if [ -z "$(pgrep -u `whoami` gpg-agent)" ]; then
- mkdir -p ${XDG_RUNTIME_DIR}/sessions
+if [[ -z "$(pgrep -u `whoami` gpg-agent)" ]] && [[ -n $XDG_RUNTIME_DIR ]] && type gpg-agent &>/dev/null; then
+ mkdir -p "${XDG_RUNTIME_DIR}/sessions"
gpg-agent --daemon --write-env-file "${XDG_RUNTIME_DIR}/sessions/gpg" &>/dev/null
fi
-if [ -f "${XDG_RUNTIME_DIR}/sessions/gpg" ]; then
+if [[ -f "${XDG_RUNTIME_DIR}/sessions/gpg" ]]; then
. "${XDG_RUNTIME_DIR}/sessions/gpg"
export GPG_AGENT_INFO
#export SSH_AUTH_SOCK
@@ -57,18 +78,18 @@ _JAVA_OPTIONS=''
_JAVA_OPTIONS+=' -Dawt.useSystemAAFontSettings=on'
_JAVA_OPTIONS+=' -Dswing.aatext=true'
_JAVA_OPTIONS+=' -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'
-if [ -n "$TMPDIR" ]; then
+if [[ -n $TMPDIR ]]; then
_JAVA_OPTIONS+=" -Djava.io.tmpdir=$TMPDIR"
fi
export _JAVA_OPTIONS
# X11
-if [ -z "$XAUTHORITY" ]; then
+if [[ -z $XAUTHORITY ]]; then
export XAUTHORITY=$HOME/.Xauthority
fi
# D-Bus
-if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
+if [[ -z $DBUS_SESSION_BUS_ADDRESS ]] && type dbus-launch &>/dev/null; then
# I want a separate instance for each login
#dbus-launch > "${HOME}/.cache/sessions/dbus"
#. "${HOME}/.cache/sessions/dbus"
@@ -79,6 +100,6 @@ if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
fi
# Load any box-specific stuff
-if [ -f "$HOME/.profile.local" ]; then
+if [[ -f "$HOME/.profile.local" ]]; then
. "$HOME/.profile.local"
fi