Nautilus: Open folder in terminal when using tmux
I haven't used Linux as my main driver in a while, but there used to be a program nautilus-open-terminal
for doing this, not sure if it's supported on Fedora though. Also, though I don't know if it's possible to install it on non-Ubuntu/Debian systems Canonical's Unity DE has this functionality built in, you could probably replicate the method used there in Gnome.
EDIT: In light of your comment, you might add the lines to your .profile
to always open tmux in the current working directory of gnome-terminal as a disowned process (i.e. tmux ./; disown -r && killall gnome-terminal
) so that when you right click and open terminal in directory it opens a gnome-terminal, and immediately opens an independant tmux windows, passing the working directory recieved by nautilus as an argument.
UPDATE: Okay, I have found two methods. Now each of these have their own issues, but hopefully one of them will work well enough for you. These methods were tested on a Debian 8.7 installation using Bash as the shell and the program nautilus-open-terminal
to launch a terminal window in the current Nautilus/Nemo directory.
Method 1.) Simply add tmux
to the very end of your .bashrc
file (or in your case .zshrc
.). Now any terminal window you open will immediately open tmux as a process in the working directory.
The pro to this method is it is simple and only opens one window.
The major con to this method is it will always run as a nested process in the current shell, so if that's a problem you may want to use the other method instead.
Method 2.) Add the line gnome-terminal -e tmux ./
(no quotes around the process name this time) to your .bashrc
or .zshrc
file. This will open a new terminal window that contains tmux as the main process.
The pros for this method are that the tmux window will be a detached process, and will still open with the current working directory set to the Nautilus/Nemo window's directory.
The con is that while it opens a tmux dedicated window, exit
cannot be added to the .bashrc
file or it will kill the tmux window as well. With that said the gnome-terminal that is used to spawn the tmux window can still be closed manually by clicking the x
on the window, or running exit
directly in the gnome-terminal once tmux has opened.
While the second method is less convenient in that you have to manually close the excess terminal window; it will open a dedicated tmux window in the current directory when the Open In Terminal
context menu option is clicked.