Open terminal from Nautilus right-click menu

On Ubuntu versions prior to 19.04 there used to be an "Open terminal" menu item in the Nautilus context menu. In 19.04 this changed to "Open in terminal" and I have to manually cd back home from "Desktop" where it starts, not what I want. There are plenty of suggestions to this, e.g. putting a "cd" at the end of the .bashrc file. I think this is a bit of an overkill - I simply want to have a replica of Ctrl-Alt-T on the convenient desktop right-click menu. I can't even find the .desktop file that creates this menu item! (I've looked in /usr/share/applications and ~/.local/share/applications, but nothing seems to create a terminal window). This should be simple, but it annoys me I can't solve this!

Addition: Oh, let me specify, I'm using the Gnome desktop, forgot to mention that!


Solution 1:

The right-click desktop, "Open in Terminal" option is in recent Ubuntu versions provided by the Gnome Shell desktop extension because it is not anymore nautilus that manages the desktop. This option is however consistent with the same right-click option in Files (nautilus).

Many users will prefer the current behaviour, where the right-click context menu opens the terminal in the current folder. The context menu is also aimed for that: have an action that applies to the object you are working with. In this case, have an action that opens the terminal in the folder you are currently working in. By extension, it is normal that a right-click on your desktop would open the terminal in the Desktop folder so you immediately can work with the files on your desktop.

If you just want a standard launching behaviour, there are enough alternatives.

  • An icon on the Dock can give you convenient one-click access to a terminal opening in your home folder - you do not even need to see the desktop for this
  • The build-in Alt+Ctrl+T is by far the quickest way to launch quickly launch a terminal opening in your home folder, anytime, anywhere.
  • You could remove nautilus-extension-gnome-terminal to remove this right-click option that does not behave like you prefer, and instead add a custom right-click menu option through a nautilus script (very easy to do) or a nautilus python script (see second part of the accepted answer, less easy, but integrates better). (This also answers your query on how this right-click menu item is implemented, not through a .desktop file, but through a nautilus extension).