[FIX][SHELL] Modify PATH at login only
It's cleaner to only export my modified PATH when I'm logging in, instead of doing it at each shell launch. Because Zsh and Bash don't use the same mechanism to let you know you are in a login session, you gotta check both separately. But that doesn't matter because lightdm doesn't launch `sh` as a login shell anyway... So the condition is super messy.
This commit is contained in:
parent
02ad16c4e8
commit
fde97e5b66
|
@ -55,9 +55,6 @@ source ~/.profile
|
||||||
# Import my prompt
|
# Import my prompt
|
||||||
source ~/.bash_prompt
|
source ~/.bash_prompt
|
||||||
|
|
||||||
# set PATH so it includes user's private bin directories
|
|
||||||
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
|
|
||||||
|
|
||||||
# Export our directory to Termite for opening new terminals
|
# Export our directory to Termite for opening new terminals
|
||||||
if [[ $TERM == xterm-termite ]]; then
|
if [[ $TERM == xterm-termite ]]; then
|
||||||
. /etc/profile.d/vte.sh
|
. /etc/profile.d/vte.sh
|
||||||
|
|
|
@ -1,6 +1,27 @@
|
||||||
|
# Export variables during login only, for Bash and Zsh
|
||||||
|
if { [ -n "$BASH_VERSION" ] && shopt -q login_shell; } ||
|
||||||
|
{ [ -n "$ZSH_VERSION" ] && [[ -o login ]]; } ||
|
||||||
|
# FIXME: I don't know why lightdm doesn't run sh as a login shell
|
||||||
|
[ "$0" = /etc/lightdm/Xsession ]; then
|
||||||
# Add our scripts to the path
|
# Add our scripts to the path
|
||||||
export PATH="$HOME/.scripts:$PATH"
|
export PATH="$HOME/.scripts:$PATH"
|
||||||
|
|
||||||
|
# Rust installation
|
||||||
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
|
|
||||||
|
# User-local bin directories
|
||||||
|
export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
|
||||||
|
|
||||||
|
# Color ls output depending on filetype with dircolors
|
||||||
|
[ -e "/etc/DIR_COLORS" ] && DIR_COLORS="/etc/DIR_COLORS"
|
||||||
|
[ -e "$HOME/.dircolors" ] && DIR_COLORS="$HOME/.dircolors"
|
||||||
|
[ -e "$DIR_COLORS" ] || DIR_COLORS=""
|
||||||
|
eval "$(dircolors -b $DIR_COLORS)"
|
||||||
|
|
||||||
|
# Use lesspipe as a file preprocessor (unlike bat, can somewhat read pdf)
|
||||||
|
{ [ -x /usr/bin/lesspipe.sh ] && eval "$(lesspipe.sh)"; } ||
|
||||||
|
{ [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"; } # Quoting seems necessary
|
||||||
|
|
||||||
# Export our favorite editor
|
# Export our favorite editor
|
||||||
export EDITOR=vim
|
export EDITOR=vim
|
||||||
export VISUAL=$EDITOR # Also use it when asking for a GUI
|
export VISUAL=$EDITOR # Also use it when asking for a GUI
|
||||||
|
@ -10,12 +31,6 @@ export TERMINAL=termite
|
||||||
# Use my own ranger config file with all mappings defined
|
# Use my own ranger config file with all mappings defined
|
||||||
export RANGER_LOAD_DEFAULT_RC=FALSE
|
export RANGER_LOAD_DEFAULT_RC=FALSE
|
||||||
|
|
||||||
# Color ls output depending on filetype with dircolors
|
|
||||||
[ -e "/etc/DIR_COLORS" ] && DIR_COLORS="/etc/DIR_COLORS"
|
|
||||||
[ -e "$HOME/.dircolors" ] && DIR_COLORS="$HOME/.dircolors"
|
|
||||||
[ -e "$DIR_COLORS" ] || DIR_COLORS=""
|
|
||||||
eval "$(dircolors -b $DIR_COLORS)"
|
|
||||||
|
|
||||||
# Use less as my default pager
|
# Use less as my default pager
|
||||||
export PAGER=less
|
export PAGER=less
|
||||||
# Allow for colorful man pages, clear the screen on exit
|
# Allow for colorful man pages, clear the screen on exit
|
||||||
|
@ -28,15 +43,9 @@ export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
|
||||||
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
|
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
|
||||||
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
|
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
|
||||||
|
|
||||||
# Use lesspipe as a file preprocessor (unlike bat, can somewhat read pdf)
|
|
||||||
{ [ -x /usr/bin/lesspipe.sh ] && eval "$(lesspipe.sh)"; } ||
|
|
||||||
{ [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"; } # Quoting seems necessary
|
|
||||||
|
|
||||||
# Use my preferred pager settings for bat
|
# Use my preferred pager settings for bat
|
||||||
export BAT_PAGER="$PAGER $LESS"
|
export BAT_PAGER="$PAGER $LESS"
|
||||||
|
fi
|
||||||
|
|
||||||
# Rust installation
|
# Use keychain to handle ssh-agent, in interactive shell too
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
||||||
|
|
||||||
# Use keychain to handle ssh-agent
|
|
||||||
eval "$(keychain --eval id_rsa --quiet)"
|
eval "$(keychain --eval id_rsa --quiet)"
|
||||||
|
|
Loading…
Reference in a new issue