Change Ubuntu 18.04 Nautilus context menu "Open in Terminal" from "Gnome-terminal" to "Tilix"

Any idea on how may be changed context-menu from default gnome-terminal to tilix in Ubuntu 18.04 Bionic Beaver?

Already tried renaming /usr/bin/gnome-terminal to /usr/bin/gnome-terminalbackup, then /usr/bin/tilix to /usr/bin/gnome-terminal, but without success, context-menu keeps running `gnome-terminal.

Asked By: Ferrari21

||

a) Run apt install filemanager-actions-nautilus-extension

b) Run FileManager-Actions Configuration Tool

c) File => New Action

d01) Action tab: Mark Display item in location context menu

FileManager Actions a

d02) Command tab:

  • Path: /usr/bin/tilix
  • Parameters: --working-directory=%d/%b
  • Working directory: %d

FileManager Actions b

e) Restart Nautilus

Answered By: Borba88

As Borba88 explained, you can use FileManager-Action Configuration Tool to append a Open in... entry in the contextual menu of Nautilus. Actually it allows you to bind any command to any context label (i.e., the entry/text displayed in the menu).

Precision: Actually, it requires another step to be really utilizable (i.e., on par with the default option in the contextual menu of Nautilus). You will probably want to remove the “FileManager-Actions” root menu, so it doesn’t take an extra click to open the (new) terminal:

To achieve this, just go in Edit > Preferences > And in Nautilus menu layout, unselect the option Create a root 'FileManager-Actions' menu.

You’re done. Congrats. 😉

Btw, if you are looking for an efficient terminal, I suggest you to try Alacritty. Also FileManager-Actions is in the AUR of Arch Linux.

Answered By: Louis

The previous answers didn’t work for me, but using python-nautilus did the trick (as seen here):

sudo apt update; sudo apt install python-nautilus

Create the file ~/.local/share/nautilus-python/extensions/open-alacritty.py with the following content:

import os

from gi.repository import Nautilus, GObject

class ColumnExtension(GObject.GObject, Nautilus.MenuProvider):
    def __init__(self):
        pass
    def menu_activate_cb(self, menu, file):
        os.system("/usr/bin/alacritty --working-directory " + file.get_location().get_path() + "&")

    def get_background_items(self, window, file):
        item = Nautilus.MenuItem(name='NautilusOpenAlacritty', 
                                         label='Open in Alacritty', 
                                         tip='',
                                         icon='')
        item.connect('activate', self.menu_activate_cb, file)
        return item,

Restart Nautilus. When right-clicking inside a directory in Nautilus, you should now be able to see a new option "Open in Alacritty" above "Open in Terminal".

You can of course substitute alacritty for tilix or any other terminal emulator if you prefer.

Answered By: Sébastien Lavoie
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.