I set a custom $PATH in ~/.bashrc with PATH=$HOME/.bin:$PATH. When I launch the geany from the terminal it is able to find my custom build tools that are located in $HOME/.bin. When I launch Geany with an XFCE launcher, it doesn't pick up the custom path and my custom build tools do not work. Is it possible to set a custom path such that the launcher will pick it up? I would prefer not to have to create a custom .desktop file.

While Is there a ".bashrc" equivalent file read by all shells? would provide an answer if I knew what shell, and how that shell is started, is used when I use a shortcut to start a program. Presumably, it is not an interactive bash shell or else .bashrc would be sourced.

  • One hacky way to perform this would be to export the PATH in ~/.xinitrc. But that assumes you're using a display manager that executes xinitrc. Most XFCE users use GDM (Gnome Display Manager) which does not care about xinitrc – grochmal May 30 '16 at 3:29
  • .bashrc is used only by interactive bash shells. There are several alternatives - unix.stackexchange.com/a/3085/90751 is the most thorough answer I can find. – JigglyNaga May 30 '16 at 7:56

Every shell has a different way of sourcing environment variables (e.g., Is there a ".bashrc" equivalent file read by all shells?). For graphical programs which are started via the shell underlying the display manager, depending on how the display manager was started, the environment variables are set in different places (e.g., .xsession or .xinitrc).

For systems with PAM, it seems pam_env is consistently "sourced" at login.

I was able to solve my problem by creating .pam_environment:

PATH DEFAULT=/home/strongbad/.bin

I had to hardcode in my home directory, despite the man page saying that:


should work.

I also had to modify /etc/profile from




since /etc/profile was simply overwriting the value set by .pam_environment.

In order to refresh .pam_environment you need to logout/login. If you screw up $PATH, it can make logging in difficult. It is worth keeping your self logged in someplace else (e.g., a TTY) so that you can fix things easily.

  • It looks like if you put this in ~./.pam_environment it might properly resolve your home directory while still hopefully being sourced early and you could always edit the system version of the file to append/prepend for /etc/profile. – dragon788 Jun 30 '17 at 0:04

I would just attach the new path export to the launcher directly. For example change the command in the launcher to

export "PATH=$HOME/.bin:$PATH" ; geany %F

You should be able to directly edit the launcher file for Geany in "/usr/share/applications/geany.desktop" this would have a more system wide effect for the application launcher.

If you want all users on the system to have a local "$HOME/.bin" on their path variable then you could add it to you "/etc/environment" file. Keep in mind that this will affect all users on the system and you would want to create this directory in all users folders to avoid errors for those users. Including "/root[/.bin]".

Not the answer you're looking for? Browse other questions tagged or ask your own question.