1

I know this is to be done by creating a .contract file in /usr/share/contractor.

For example, one like this will add a menu option to open a folder as root.

[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

How to adjust such a contractor file for the 'make executable' option? What about a 'Run' option for the executable files?

1
sudo gedit /usr/share/contractor/make_executable.contract

Add this content and save:

[Contractor Entry]
Name=Make executable
Icon=name.of.icon.wanted
Description=Make a file executable
MimeType=inode;application/x-sh;application/x-executable;
Exec=gksudo chmod +x %U

Should do the trick.

But it is possible that in elementaryOS a file that was made executable may still lack the option of being run from context menu or click: it may open instead in a text editor, etc.

To add a 'Run' menu entry to run such a file create a new contractor entry

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

like this:

[Contractor Entry]
Name=Run 
Icon=run
Description=Run
MimeType=inode;application/x-sh;application/x-executable;
Exec=sh %U
  • 1
    Did that but in eOS Freya a such file is still opened in a text editor. Then, I though that a 'Run' context menu option would be great. I have added that to the answer and also updated the question to fit. – user32012 Apr 1 '15 at 12:24
  • Did you make the file executable??? xDDDD – Crutchcorn Apr 2 '15 at 4:52
  • I did create context menu entry to make executable and it becomes so I guess, but in eOS' file manager I have this problem with some such files that open as text when I click them although they are executable. This problem is absent in Nautilus or Thunar. Therefore the need for the separate 'run' command. – user32012 Apr 2 '15 at 10:33

Your Answer

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