summaryrefslogtreecommitdiff
path: root/zprofile
blob: b6b445ee44f12a9193052633d25b3eeb147b90df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env zsh

# Default programs
export WM='awesome'
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"