dotfiles/home/.config/shell/environment
2023-08-02 01:45:32 +02:00

93 lines
3.6 KiB
Bash
Executable file

#!/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.
# 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"
# XDG Standard paths
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"
# 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"
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"
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"
export NUGET_PACKAGES="$XDG_CACHE_HOME/NuGetPackages"
export PARALLEL_HOME="$XDG_CONFIG_HOME/parallel"
export RANDFILE="$XDG_CACHE_HOME/rnd"
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc.py"
export PYTHONPYCACHEPREFIX="$XDG_CACHE_HOME/python"
export PYTHONUSERBASE="$XDG_DATA_HOME/python"
# Less commonly used applications
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"
# Colorful man pages!
# Use neovim to open man pages
# shellcheck disable=SC2155
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
else
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')"
fi
# Other program settings
export HISTTIMEFORMAT="%Y-%m-%d %T "
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
export QT_QPA_PLATFORMTHEME="qt5ct" # Have QT use theme from qt5ct.
#export QT_STYLE_OVERRIDE="gtk2" # Have QT use the gtk2 theme (needs aur/qt5-styleplugins)
#export QSG_RENDER_LOOP=basic # Fix Stremio freezing
# Remove irrelevant variables added for posix compatibility
unset posix