summaryrefslogtreecommitdiff
path: root/zprofile
diff options
context:
space:
mode:
Diffstat (limited to 'zprofile')
-rwxr-xr-xzprofile55
1 files changed, 55 insertions, 0 deletions
diff --git a/zprofile b/zprofile
new file mode 100755
index 0000000..f7b2549
--- /dev/null
+++ b/zprofile
@@ -0,0 +1,55 @@
+#!/usr/bin/env zsh
+
+# Default programs
+export EDITOR='nvim'
+export TERMINAL='alacritty'
+export BROWSER='launch firefox'
+export SUDO='doas'
+
+# Use sudo=${SUDO-sudo}
+[ $EUID = 0 ] && export SUDO='' # When running as root, don't use sudo
+
+# Make programs follow the XDG base directory specification
+export XDG_CACHE_HOME="$HOME/.cache"
+export ANSIBLE_GALAXY_CACHE_DIR="${XDG_CACHE_HOME}/ansible/galaxy_cache"
+export DOCKER_CONFIG="$XDG_CACHE_HOME/docker"
+export XAUTHORITY="$XDG_CACHE_HOME/Xauthority"
+
+export XDG_CONFIG_HOME="$HOME/.config"
+export ANSIBLE_HOME="${XDG_CONFIG_HOME}/ansible"
+export ANSIBLE_CONFIG="${XDG_CONFIG_HOME}/ansible/ansible.cfg"
+export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
+export MBSYNCRC="$XDG_CONFIG_HOME/mbsync/config"
+export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config"
+export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
+export X11CONFIG="$XDG_CONFIG_HOME/x11" # Used for X11 scripts
+export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
+
+export XDG_DATA_HOME="$HOME/.local/share"
+export CARGO_HOME="$XDG_DATA_HOME/cargo"
+export GNUPGHOME="$XDG_DATA_HOME/gnupg"
+export GRADLE_USER_HOME="$XDG_DATA_HOME/gradle"
+export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store"
+export PYTHONUSERBASE="$XDG_DATA_HOME/python"
+export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=$XDG_DATA_HOME/java"
+
+export XDG_STATE_HOME="$HOME/.local/state"
+export LESSHISTFILE='-' # Disable this, but it would be considered a state file
+export ZHISTFILE="$XDG_STATE_HOME/zsh/zhistory" # Used to set HISTFILE in zshrc without exporting since HISTFILE is generic to most shells, and desired behavior is for zsh to have its own history file
+
+# Path
+setopt nullglob # Set in case .local/bin doesn't exist
+for lbin in "$HOME/.local/bin"{/,/*/}; do export PATH="${lbin%/}:$PATH"; done 2>/dev/null # Add ~/.local/bin and all sub dirs
+export PATH="$HOME/.local/opt:$PATH"
+export PATH="$CARGO_HOME/bin:$PATH"
+export PATH="$PYTHONUSERBASE/bin:$PATH"
+
+# Theming
+export QT_QPA_PLATFORMTHEME='gtk2'
+
+# Misc Zsh setup
+mkdir -p "$(dirname "$ZHISTFILE")"
+source "$ZDOTDIR/profiles/zprofile.$HOST" 2>/dev/null # Source additional host-specific profiles
+
+# Autostart X after login
+[ -z $DISPLAY ] && [[ $UID != 0 ]] && [[ $TTY =~ /dev/tty(1|C0) ]] && startx "$X11CONFIG/xinitrc"