Category: Raspberry Pi

Implement .xsessionrc on Raspbian

A script within /etc/X11/Xsession.d called 75source-profile causes any changes to the $PATH made inside $HOME/.xsessionrc to be lost, as it reads $HOME/.profile after the $PATH is altered. The correct way to deal with this is to rename  or copy the 40×11-common_xsessionrc to a file with higher serial number that will run after the 75, for instance 80×11-common_xsessionrc and implement any changes to the $PATH within $HOME/.xsessionrc, thus: for UBIN in $HOME/bin $HOME/.local/bin; do { [ -d “$UBIN” ] && export PATH=$UBIN:$PATH }; done This will ensure that if any of the directories $HOME/bin and $HOME/.local/bin exist will be appended in the beginning of the $PATH Furthermore, to avoid duplication of those directories in the $PATH, it is necessary to edit $HOME/.profile and comment out the section that reads: # set PATH so it includes user’s private bin directories if [ -d “$HOME/bin” ]; then   PATH=$HOME/bin:$PATH fi Like this: # set PATH so it includes user’s private bin directories #if [ -d “$HOME/bin” ]; then #  PATH=$HOME/bin:$PATH #fi Finally, edit $HOME/.bashrc and add the following at the end: for UBIN in $HOME/bin $HOME/.local/bin; do { [[ -d $UBIN ]] \ && [[ ! $PATH =~ $UBIN ]] \ && PATH=$binDir:$PATH }; done That’s it! Congratulations, now you

Continue readingImplement .xsessionrc on Raspbian