76

The nautilus-open-terminal package adds a menu/right-click option to open a terminal in the current directory.

I want to change this from opening gnome-terminal to opening terminator. There is some advice on changing the default terminal emulator here, however these instructions do not appear to be valid any more, and I can't find any place in the system settings where the default emulator can be changed.

I also tried:

$ sudo update-alternatives --config x-terminal-emulator

choosing

* 0            /usr/bin/terminator               50        auto mode

But this does not appear to have any effect. Any idea how I can get this to work?

YXD
  • 1,099
  • Here's a question about setting the default terminal emulator. – user32085 Nov 07 '11 at 15:31
  • Ok, I tried that and it doesn't work. In fact the "Open in Terminal" command does nothing now – YXD Nov 07 '11 at 15:37
  • Tested this just now to see how was it working for terminator, with terminator you need to set up the full path to the program, after that it will work like a charm by pressing ctrl+alt+t or when you have a program calling the terminal. – Bruno Pereira Nov 07 '11 at 15:49
  • 1
    Thanks for the advice. Everything you've described works fine, however I can't get nautilus-open-terminal working with Terminator, which is really my original question. If you or anyone has any insights into how I can make this work I'd be very grateful. – YXD Nov 07 '11 at 16:41

9 Answers9

51

Ubuntu 13.04: (in case you came here via google)

You can't change the terminal app used anymore.

Details: nautilus-open-terminal uses GAppInfo to launch the terminal process, which uses a hard coded list of terminal emulators: https://gitlab.gnome.org/GNOME/glib/-/blob/main/gio/gdesktopappinfo.c#L2581

Solution:

  1. Remove gnome-terminal:

    sudo apt-get remove gnome-terminal
    
  2. Symlink terminator to gnome-terminal:

    sudo ln -s /usr/bin/terminator /usr/bin/gnome-terminal
    
  • See https://bugzilla.gnome.org/show_bug.cgi?id=743626 --- I think this is a bug. – Rmano Jan 28 '15 at 09:40
  • Really it is https://bugzilla.gnome.org/show_bug.cgi?id=627943 --- here since 2010. Ok. – Rmano Jan 29 '15 at 08:08
  • For Ubuntu Mate, do: sudo apt-get remove mate-terminal followed by sudo ln -s /usr/bin/terminator /usr/bin/mate-terminal. – user_1_1_1 Nov 14 '16 at 23:04
  • 15
    This does not work in 16.04. I can launch gnome-terminal from the command line, but Nautilus's "Open in Terminal" option does nothing. – Cerin Feb 03 '17 at 17:46
  • On 16.04, I use https://gist.github.com/randy3k/c7f69adc2754f4b2bff361fbfd0fdc5d to open io.elementary.terminal, I guess you just have to copy it to /usr/share/nautilus-python/extensions and patch it for terminator. – Randy Lai Aug 11 '17 at 20:30
  • As @Cerin said, doesn't work in 16.04, or 17.10, or Manjaro Gnome, openSUSE Gnome, or Solus Gnome. Basically, any Gnome distro it seems using Gnome 3.26.x – Delorean Nov 30 '17 at 20:58
  • This should be the related GitLab issue. Gnome seems to be migrating away from Bugzilla. https://gitlab.gnome.org/GNOME/glib/issues/338 Go and upvote this. – Daniel Cheung Mar 03 '20 at 19:39
  • I also had to symlink /usr/libexec/gnome-terminal-server in order for it to work. – Jan Pokorný Mar 28 '22 at 09:06
  • issue https://gitlab.gnome.org/GNOME/glib/-/issues/338 is now closed and "will be in the 2.76.0 release in <6 months’ time." – dimisjim Oct 28 '22 at 06:29
  • On 23.04, clicking "Open in terminal" will fail with "org.gnome.Nautilus[35888]: Error creating terminal: The name org.gnome.Terminal was not provided by any .service files" in the syslog. – brandones Sep 01 '23 at 14:53
45

Install nautilus-actions (AKA filemanager-actions)

We may define our own right-click context menu items with nautilus-actions.

  • Run the Nautilus-Actions Configuration Tool either from the Dash, or from a terminal with

    nautilus-actions-config-tool
    

    screenshot

  • In the Action tab give your action a sensible label, e.g. "Open in Terminator" and choose to display this in the selection or the context menu.

  • Next open the Command tab to enter the commands to run

    screenshot

  • Give in the full path to your command (/usr/bin/terminator) and program options (--working-directory=%d/%b) for opening the current path in Terminator.

  • After logging out and in again (or just restarting nautilus with nautilus -q) the right click context menu below will be displayed:

    screenshot

Pablo Bianchi
  • 15,657
Takkat
  • 142,284
  • Wow, thanks so much for the detailed writeup! I will try this tomorrow when I get to the office and report back. – YXD Nov 08 '11 at 01:43
  • 1
    Great solution. One thing: It's not really necessary to log out/in, restarting nautilus with nautilus -q is sufficient. I just proposed an edit for that. – Christoph Jan 01 '14 at 21:32
  • 1
    Nautilus-Actions can't go to relative symlinks paths, it uses absolute dispatchers, but open-in-terminal plugin opens relative paths. – unclechu Oct 01 '14 at 23:39
  • wow thank you so much I didn't know that application existed :) – Iman Akbari May 29 '16 at 07:27
  • 12
    if you don't want Open in Terminator to be in submenu, in Nautilus-Actions, go to Edit > Preferences > Disable "Create a root 'Nautilus-Actions' menu" – Hải Phong Sep 19 '16 at 01:28
  • 1
    E: Unable to locate package nautilus-actions-config-tool – Cerin Feb 03 '17 at 17:43
  • @Cerin: /usr/bin/nautilus-actions-config-tool not installed? – Takkat Feb 03 '17 at 22:18
  • 3
    The project seems to be archived and the package is no longer available in the apt repositories (tested on Pop!_OS 22.04) – Sean Bone May 03 '22 at 11:01
24

To configure the default terminal in gnome you need to install dconf-tools (sudo apt-get install dconf-tools).

After that you can use dconf-editor or gsettings to set your favorite terminal emulator. This guide uses gsettings.

After installing terminator type this command

gsettings set org.gnome.desktop.default-applications.terminal exec /usr/bin/terminator

Set the exec-args for the terminal you need, in your case -x to execute the rest of the necessary arguments of nautilus-open-terminal.

gsettings set org.gnome.desktop.default-applications.terminal exec-arg "-x"

After this terminator will be your default terminal emulator, when nautilus-open-terminal calls the default terminal it should open terminator instead of gnome-terminal.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
Bruno Pereira
  • 73,643
  • The arguments are required. Have edited and accepted. – YXD Nov 08 '11 at 12:45
  • What arguments are you using with terminator, if its useful I will edit the answer and add that information. – Bruno Pereira Nov 08 '11 at 12:59
  • it's org.gnome.desktop.default-applications.terminal exec-arg '-x' as in my edit. – YXD Nov 08 '11 at 13:22
  • But the key point is it's already set correctly by default - what works for gnome-terminal works for terminator. – YXD Nov 08 '11 at 13:23
  • Ok, then I will leave it like this, just added an extra point to make clear that nautilus-open-terminal will call the default and that will then be terminator and not gnome-terminal. – Bruno Pereira Nov 08 '11 at 13:45
  • Hang on, I think there was a miscommunication. The default setting with gnome-terminal is exec-arg "-x" and terminator also requires this argument to work with nautilus-open-terminal. If you set exec-arg "" then nothing happens when you use nautilus-open-terminal with either gnome-terminal or terminator. In summary what you have on there at the moment is incorrect – YXD Nov 08 '11 at 16:24
  • On 13.04, it would be... gsettings set org.gnome.desktop.applications.terminal exec /usr/bin/terminator and gsettings set org.gnome.desktop.applications.terminal exec-arg "-x" – jjkim Apr 30 '13 at 05:31
  • @nopacus this does not seem to work anymore, I still get the "normal" terminal. Maybe because of https://bbs.archlinux.org/viewtopic.php?id=159139 – Christoph May 26 '13 at 12:08
  • Just tested my instructions on 13.04, they work and are valid, no modifications on the commands – Bruno Pereira May 27 '13 at 04:44
  • @BrunoPereira are you sure? I just followed these instructions, and for me, the normal terminal appears. – Christoph Jul 09 '13 at 12:19
  • @Cristoph, I filed https://bugzilla.gnome.org/show_bug.cgi?id=743626 – Rmano Jan 28 '15 at 09:43
  • 10
    This doesn't work on Ubuntu 16.04... – Cerin Feb 03 '17 at 17:42
  • 1
    This doesn't work on Ubuntu 18.04 – Daniel Cheung Oct 04 '19 at 14:39
  • 1
    This doesn't work on Ubuntu 19.10 – Ali Tou Nov 09 '19 at 19:02
  • 10
    This doesn't work on Ubuntu 20.04 – drkostas Jul 13 '20 at 10:07
  • 3
    This doesn't work on Ubuntu 22.04 – Vinay Verma May 20 '22 at 15:04
  • On Ubuntu 23.10 you can edit this with dconf /org/gnome/desktop/applications/terminal/exec and /org/gnome/desktop/applications/terminal/exec-arg. So for Guake terminal I used guake and `` values. This means Ctrl+T now opens guake, however, Nautilus still opens the original terminal. – Paloha Jan 10 '24 at 11:25
15

Update for Ubuntu 19.04 and 20.04

I agree with this answer by Takkat which suggests to install nautilus-configuration-tool to solve this, but since Ubuntu 19.04 (Disco Dingo) therefore also for Ubuntu 20.04 (Focal Fossa) this package is called filemanager-actions. I know thanks to the answer by N0rbert. So if you are getting this error: E: Unable to locate package nautilus-actions-config-tool Use these commands:

sudo apt install filemanager-actions  # To install
fma-config-tool  # To run the configuration tool

and follow the instructions in the answer by N0rbert.

If you want your action to appear in the top level of the context menu, go to Edit > Preferences > Runtime Preferences and uncheck the Create a root 'FileManager-Actions' menu (based on the comment from stefg-bz).


Offtopic but related (Yakuake terminal)

In case you found this answer because you are trying to achieve the same thing as the OP asked, but with Yakuake terminal, use the script yakuake-session from this repo and set the command of your action in the FileManager-Actions Configuration Tool like this:

Path: /usr/bin/yakuake-session
Parameters: --workdir=%d/%b
Working directory: %d

I also had to do sudo apt install qdbus-qt5 in order to make it work otherwise I was getting yakuake-session: error: cannot connect to Yakuake.

I am unable to comment so I add a new answer (I do not understand this rule tbh)

Paloha
  • 1,037
11

For Ubuntu 22.04 and above

Tell gnome-terminal to open your preferred terminal

A somewhat hacky workaround, but it works for me:

  1. Open gnome-terminal and navigate to Preferences > (your profile) > Command
  2. Check "Run custom command instead of my shell" and add the command for your preferred terminal emulator
  3. Under "Preserve working directory" select "Always"

Warning: this will cause gnome-terminal to close immediately after startup. I recommend testing with "When command exits" set to "Hold the terminal open" to make sure everything works as expected.

Reverting: run gnome-terminal --preferences from another terminal to open just the preferences window, and uncheck "Run custom command instead of my shell".

enter image description here

Sean Bone
  • 634
  • 4
    Sure, it's somewhat "hacky" but IMO way easier (and far less invasive) than having to install other software packages and tweak numerous things. Thanks. – Inactivist May 10 '22 at 16:15
  • Perfect, exactly what I was looking for :) I wish I could upvote twice... – buddemat Nov 20 '22 at 15:21
  • This is a fantastic answer and also the only one that works for me on Ubuntu 22.04.1. None of the other things like filemanager-actions seem available anymore. Thank you so much – user3638162 Jan 31 '23 at 12:19
  • I can't get this to work without it leaving the gnome-terminal window open for some reason on latest 22.04 - teminator opens and gnome-terminal stays open, and if I close gnome-terminal it kills terminator. – Routhinator Aug 20 '23 at 17:04
  • 1
    OK I got it working by wrapping terminator in a bash call - /bin/bash -c "/usr/bin/terminator" – Routhinator Aug 20 '23 at 17:18
2

I'm using Ubuntu 18.04 and I wan't able to solve the problem. Instead I installed nautilus-terminal which embeds your terminal into nautilus! Which is absolutely great.

Install nautilus-terminal

sudo add-apt-repository ppa:flozz/nautilus-terminal
sudo apt update
sudo apt install nautilus-terminal
nautilus -q

enter image description here

You can also configure it via dconf editor. More info in this link

Vahid
  • 173
0

I know this is an old question, but since I landed here while trying to do the same thing, here's my take for future visits.

I tried all the previous suggestions and failed, so instead I came up with this workaround (not a perfect answer, but can still be useful I guess).

Create a change_terminal.sh file

# Open a new terminator window in a detached tmux session so it remains open
cmd="terminator --working-directory=$PWD"
tmux new-session -d
tmux send-keys "$cmd" C-m
tmux dettach
# Close active window (gnome-terminal since the new one hasn't loaded yet)
xdotool key --clearmodifiers Ctrl+Shift+Q key --clearmodifiers KP_Enter

and give it execution rights:

chmod +x change_terminal.sh

Create the following alias:

alias ct="path/to/change_terminal.sh"

Now you just open a default terminal from nautilus in the desired location and type 'ct' to close it and open a terminator terminal in the same location.

0

Note: This answer works for Ubuntu 22.04.1 LTS.

Download and install the most recent deb package: https://github.com/bassmanitram/actions-for-nautilus/tree/main/dist

Open the application Actions For Nautilus configuration.

In the top left, add an action as shown: Open in Terminator Menu option.

You should also only allow directory in the File types section. Save the action then Restart nautilus (file manager). This will give you the desired option in the menu. If you don't want the original Open in Terminal option, then you can just uninstall gnome-terminal with sudo apt remove gnome-terminal.

-1

I've created this alias:

alias tt='terminator & disown & exit'

Now when I click on the option 'open in terminal', I just type 'tt' in the opened terminal and it switches to terminator, in the same location.

I wanted something simpler but, as you can see from the previous answers there is no such thing (until now) as a nautilus-tweaker or a tool to personalize it's behaviour.