4

Here it is the solution in order to add the 'open terminal here' into the context menu of Elementary OS' file manager (generically called 'Files' - the executable is pantheon-files).

For that specific demand, the idea is to create the file /usr/share/contractor/terminal.contract and add something like

[Contractor Entry]
Name=Open Terminal here
Icon=terminal
Description=Open Terminal here
MimeType=inode;application/x-sh;application/x-executable;
Exec=pantheon-terminal -d %U
Gettext-Domain=pantheon-terminal

But how to adapt that and have a model to add other commands, namely - following my order of priorities - 'open folder as root'?

10

In order to create 'Open folder as root' context menu command - and in order to create any new such command - a new *.contract file has to be created in /usr/share/contractor.

To create the file in gedit:

sudo gedit /usr/share/contractor/Open_as_admin.contract

For 'Open folder as root' - that file would have to contain something like

[Contractor Entry]
Name=Open folder as root
Icon=gksu-root-terminal
Description=Open folder as root
MimeType=inode;application/x-sh;application/x-executable;
Exec=gksudo pantheon-files -d %U
Gettext-Domain=pantheon-files

(but no icon appears in te context menu anyway)

enter image description here

  • @ciprius Great explanation! Do you know if is possible a submenu? Thanks in advance! – Costales Jan 18 '15 at 16:14
  • 1
    @costales - do not know, sorry – user32012 Mar 24 '15 at 10:07
  • 3
    If its not showing up for you make sure you have gksudo installed. I didn't and I had to remove parts of the config file until I realized what was stopping it from showing up. – kagronick Jul 19 '15 at 4:43
1
[Contractor Entry]
Name=Open folder as root
Icon=gksu-root-terminal
Description=Open folder as root
MimeType=inode;application/x-sh;application/x-executable;
Exec=/usr/bin/io.elementary.files-pkexec
Gettext-Domain=pantheon-files

This worked for me in Elementary OS 5 Juno 01/20/2019. Also, use nano instead of gedit.

  • (1) This is the same as the accepted answer except for one line. What is the significance of that line? Is your answer better than the other one? (2) What’s wrong with gedit? – G-Man Jan 21 at 2:30
  • Brief: gksu is deprecated. It is removed from Debian, Ubuntu 18.04 and other newer Linux distribution version. – n00b Jan 21 at 3:54
  • nano is already in the system gedit is not you would need to install it. – n00b Jan 21 at 3:57
  • 1
    @G-Man - not using elementary now but I welcome this answer, as that line seems better. (Maybe a comment would have been preferable, but this is ok for a new user). I would even integrate that to my answer. I prefer gedit on all gtk desktops though, I simply never use nano. – user32012 Jan 21 at 5:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy