dotfiles/home/.config/shell/environment

146 lines
5.4 KiB
Plaintext
Raw Normal View History

2022-10-29 18:25:42 +00:00
#!/bin/sh
# Environmental variable definitions.
# This file is only sourced once after login, unlike .zshrc/.bashrc
#
# NOTE: This file shouldn't be defined for root account. Sudo
# will not source it (and neither will it source .zshrc/.zprofile),
# which means the XDG definitions will be ignored anyway, and
# defining them may break programs when root is actually logged in.
# Add all folders in ~/.local/bin into PATH
# Some window managers require this line to be in profile not in .zshenv
if [ -d "$HOME/.local/bin" ]; then
PATH+=":${$(find -L ~/.local/bin -type d | tr '\n' ':')%%:}"
fi
if [ -d "$HOME/.local/share/npm/bin" ]; then
PATH+=":$HOME/.local/share/npm/bin"
fi
# Prepend rye shims to PATH, to have rye python executables
# take priority over the system-wide python.
if [ -d "${RYE_HOME:-$HOME/.rye}/shims" ]; then
PATH="${RYE_HOME:-$HOME/.rye}/shims:$PATH"
fi
2022-10-29 18:25:42 +00:00
# Define some variables for POSIX compatibility
uid="$(id -u)"
# Default programs
export EDITOR="nvim"
export BROWSER="firefox"
export TERMINAL="alacritty"
export DIFFPROG="nvim -d"
export FILEMANAGER="pcmanfm-qt"
2022-10-29 18:25:42 +00:00
# XDG Base Directory standard paths
2022-10-29 18:25:42 +00:00
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_RUNTIME_DIR="/run/user/$uid"
2023-08-01 23:53:00 +00:00
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_BIN_HOME="$HOME/.local/bin"
# XDG User directories (should match ~/.config/user-dirs.dirs)
#export XDG_DESKTOP_DIR="$HOME/Desktop"
export XDG_DOWNLOAD_DIR="$HOME/Downloads"
export XDG_TEMPLATES_DIR="$XDG_DATA_HOME/templates"
export XDG_PUBLICSHARE_DIR="$XDG_DATA_HOME/public"
#export XDG_DOCUMENTS_DIR="$HOME/Documents"
export XDG_MUSIC_DIR="$HOME/Media/Music"
export XDG_PICTURES_DIR="$HOME/Media/Pictures"
export XDG_VIDEOS_DIR="$HOME/Media/Videos"
export XDG_SCREENSHOTS_DIR="$HOME/Media/Pictures/Screenshots"
2022-10-29 18:25:42 +00:00
# Per-Application XDG settings
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export ZSH_CACHE="$HOME/.cache/zsh"
export HISTFILE="$ZSH_CACHE/history"
export ZSH_COMPDUMP="$ZSH_CACHE/zcompdump-$ZSH_VERSION"
2022-10-29 18:25:42 +00:00
export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
export LESSHISTFILE="-"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc":"$XDG_CONFIG_HOME/gtk-2.0/gtkrc.mine"
2022-10-29 18:25:42 +00:00
export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export GOPATH="$XDG_DATA_HOME/go"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export GRADLE_USER_HOME="$XDG_DATA_HOME/gradle"
export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=$XDG_CONFIG_HOME/java"
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
2023-08-01 23:46:28 +00:00
export NPM_CONFIG_CACHE="$XDG_CACHE_HOME/npm"
export NPM_CONFIG_PREFIX="$XDG_DATA_HOME/npm"
export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR/npm"
2022-10-29 18:25:42 +00:00
export NUGET_PACKAGES="$XDG_CACHE_HOME/NuGetPackages"
2022-11-19 21:20:35 +00:00
export PARALLEL_HOME="$XDG_CONFIG_HOME/parallel"
2023-02-02 21:04:05 +00:00
export RANDFILE="$XDG_CACHE_HOME/rnd"
2023-08-01 23:45:32 +00:00
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc.py"
export PYTHONPYCACHEPREFIX="$XDG_CACHE_HOME/python"
export PYTHONUSERBASE="$XDG_DATA_HOME/python"
2022-10-29 18:25:42 +00:00
export _ZL_DATA="$XDG_DATA_HOME/zlua"
export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history"
export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime"
export IPYTHONDIR="$XDG_CONFIG_HOME/ipython"
export PYENV_ROOT="$XDG_DATA_HOME/pyenv"
export MYPY_CACHE_DIR="$XDG_CACHE_HOME/mypy"
export PYLINTHOME="$XDG_CACHE_HOME/pylint"
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
export CUDA_CACHE_PATH="$XDG_CACHE_HOME/nv"
export WINEPREFIX="$XDG_DATA_HOME/wine"
export MPLAYERHOME="$XDG_CONFIG_HOME/mplayer"
export ANDROID_HOME="$XDG_DATA_HOME/android"
export M2_HOME="$XDG_DATA_HOME/m2"
export NODE_REPL_HISTORY="$XDG_DATA_HOME/node_repl_history"
export DOTNET_CLI_HOME="$XDG_DATA_HOME/dotnet"
export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME/jupyter"
export RYE_HOME="$XDG_CONFIG_HOME/rye"
# Theming
export GTK_THEME="Tokyonight-Dark"
export GTK_USE_PORTAL=1
export QT_STYLE_OVERRIDE=kvantum
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_AUTO_SCREEN_SCALE_FACTOR="1"
export QT_QPA_PLATFORM="wayland;xcb"
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
export XCURSOR_THEME="BreezeX-RosePine-Linux"
export XCURSOR_SIZE="24"
export HYPRCURSOR_THEME="rose-pine-hyprcursor"
export HYPRCURSOR_SIZE="24"
2022-10-29 18:25:42 +00:00
2023-04-24 11:09:26 +00:00
# Colorful man pages!
# Use neovim to open man pages
2022-10-29 18:25:42 +00:00
# shellcheck disable=SC2155
2023-04-24 11:09:26 +00:00
if command -v nvim >/dev/null; then
export MANPAGER="nvim +Man!"
# If neovim isn't installed, but bat is, use it as a manpager
# (has color support)
elif command -v bat >/dev/null; then
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
# Export color definitions for less (default manpager) otherwise
2022-10-29 18:25:42 +00:00
else
2023-04-24 11:09:26 +00:00
export LESS_TERMCAP_mb="$(printf '%b' '[1;31m')"
export LESS_TERMCAP_md="$(printf '%b' '[1;36m')"
export LESS_TERMCAP_me="$(printf '%b' '[0m')"
export LESS_TERMCAP_so="$(printf '%b' '[01;44;33m')"
export LESS_TERMCAP_se="$(printf '%b' '[0m')"
export LESS_TERMCAP_us="$(printf '%b' '[1;32m')"
export LESS_TERMCAP_ue="$(printf '%b' '[0m')"
2022-10-29 18:25:42 +00:00
fi
# Other program settings
export HISTTIMEFORMAT="%Y-%m-%d %T "
2022-10-29 18:40:57 +00:00
export SUDO_ASKPASS="$HOME/.local/bin/scripts/gui/prompt/menupass"
export PIPENV_VENV_IN_PROJECT=1 # Force pipenv to create new environments within projects ./.venv
export XSECURELOCK_SHOW_HOSTNAME=0 # Don't show hostname in xsecurelock
export XSECURELOCK_SHOW_DATETIME=1 # Show current date and time in xsecurelock
2022-10-29 18:25:42 +00:00
# Remove irrelevant variables added for posix compatibility
unset posix