1

I can open my terminal emulator via a keyboard shortcut or through the apps finder that executes the exo-open --launch TerminalEmulator command. My terminal starts and I can cd to any directory and execute any binaries located on any bin directory on my system.

But whenever I launch it by right-clicking any directory on thunar and using the Open terminal here option it sometimes can't find any executable on my local binaries directory (~/.local/bin/). Simply put:

  • Open terminal via app finder, command launcher, keyboard shortcut, … → It can find local executables.
  • Open terminal via context menu on Thunar → It sometimes can't find local executables.

This happens on any terminal (xfce4-terminal, xterm, gnome-terminal). My machine is running Fedora 20 XFCE with thunar version 1.6.3-2.

I can't say for sure since when this started happening, because it has been some time, but this became more frequent in recent days. Also, I have to mention that once my terminals can find executables on my local bin directory and I add a new one, it won't find them again, until some time passes - no matter if it was launched via the thunar's context menu or not.

Has anybody noticed this behaviour too? Can somebody shed some light on what's happening here?

Update:

I've noticed that my .bash_profile file is what adds my local bin directory to the $PATH environmental variable:

PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH

And when I run a login shell (not started via the context menu), it executes .bashrc and then .bash_profile, so I proceeded to move those two lines from my .bash_profile to my .bashrc and now everything works fine.

So the question now is: why does the context menu command (which is the same as the normal command) somehow make my terminal to be launched as only interactive and not as a login terminal?

arielnmz
  • 529
  • 1
  • 6
  • 24
  • Have you checked the PATH variable has necessary bin paths ? – Tingrammer Jun 30 '14 at 07:04
  • @Tingrammer Sorry I forgot to add that, yes, the /home/user/.local/bin/ path is always present in the $PATH var. – arielnmz Jun 30 '14 at 07:28
  • @arielnmz - could you open your terminal via Thunar's context menu and then output here of the command echo $PATH? By default terminal opens in the home directory, so, for example, it probably would work if you put ./.local/bin instead of ~/.local/bin. – Wilf Jun 30 '14 at 08:41
  • You should never use relative paths in your $PATH statement. commands and scripts can change the working directory. Also $HOME is safer then ~. – coteyr Jun 30 '14 at 11:14
  • "So the question now is: why does the context menu command (which is the same as the normal command) somehow make my terminal to be launched as only interactive and not as a login terminal?" Add a new question for this. – coteyr Jun 30 '14 at 19:44
  • Do you think this is a bug in thunar? I think I'd get more feedback if I file this as a bug instead of asking here, anyway, you answered my original question, thank you. – arielnmz Jun 30 '14 at 20:30
  • No I am pretty sure it's by design. But its a pretty big debate. When you open from thunar your already logged in. When you start the emulator by hand it emulates logging in. It's been the center of a "right way/easy way" debate for a long time now. – coteyr Jun 30 '14 at 20:33
  • No, a login shell does not load .bash_profile. You need to move the PATH setting to .profile. A setting in .bashrc will only ever take effect in terminals, never in GUI applications that aren't launched via a terminal. – Gilles 'SO- stop being evil' Jun 30 '14 at 22:24
  • @Gilles the terminal that works is launched via a command, the same command that is executed when I call the context menu's option, neither are called from within another terminal. And the bit about the .bash_profile being loaded on a login shell is what the man page for bash says, as stated in the other question referenced in the answer's comments, although I'll look more into moving the path statement to .profile as you suggest. – arielnmz Jun 30 '14 at 22:34
  • @arielnmz Sorry, I meant to write: a login shell does not load .bashrc. (Unless you added . ~/.bashrc to your .bash_profile or something like it.) – Gilles 'SO- stop being evil' Jun 30 '14 at 22:40
  • @Gilles now that makes more sense, my .bash_profile indeed loads my .bashrc but the strange part is that the $PATH env var isn't modified when I call the terminal from the context menu, which means that when thunar calls that command, my terminal only loads .bashrc and ignores .bash_profile, should thunar do that? I have to mention that this happens most of the time, about 7 out of 10 times I call the context menu option, but not always. It's strange. – arielnmz Jun 30 '14 at 22:50
  • @arielnmz That's the point: launching a terminal reads only .bashrc. If you put an environment variable definition in .bashrc, it only applies to that terminal and applications launched through it. – Gilles 'SO- stop being evil' Jun 30 '14 at 22:58
  • So if I launch a terminal that reads only .bashrc and I execute the exo-open command to launch another terminal within it, that child terminal will ignore .bash_profile too? – arielnmz Jun 30 '14 at 23:04
  • @arielnmz (Unrelated to this question). You recently asked about how to find the name of a driver in the CUPS GUI, but deleted the question. I'm guessing you deleted that because you found an answer somewhere. If so, I suggest you undelete it and post an answer. It's both allowed and encouraged to answer your own questions on the site. That'll help the next person facing the same question. – derobert Jul 14 '14 at 17:01
  • @derobert I closed it because it wasn't a real issue, the think is that I thought that the packages provided by my distro contained the drivers, however, I didn't notice the ones I needed weren't part of it, and I just had to download and install it. But I'll un-delete it as soon as I have a computer at hand. Thank you. – arielnmz Jul 14 '14 at 17:33

1 Answers1

1

I would say your running into a good old classic fight. To ~/.bashrc or to ~/.profile

Checke your $PATH in both.

Read and understand https://stackoverflow.com/questions/415403/whats-the-difference-between-bashrc-bash-profile-and-environment It may answer your question.

Basically your logging in when your launch a terminal emulator, but not when you launch from thunar. This creates a different environment. There is no "right answer" to fix it, and it's a lot like vim or nano, but I usually just source a common file in ALL of them to setup my environments.

coteyr
  • 4,310
  • 1
    This is just a guess BTW but it seems right, please let us know what shell your using in each case, if this isn't it. – coteyr Jun 30 '14 at 11:19
  • I'm really sure this has to do something with my issue, but the strange part is that I can launch a working terminal with this command: exo-open --launch TerminalEmulator, and the context menu option just launches the same command: exo-open --launch TerminalEmulator --working-directory %f (with that extra param). Is thunar doing some strange thing that somehow makes the same command launch a non-login shell? – arielnmz Jun 30 '14 at 17:58