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
Description=Open folder as root
Exec=gksudo pantheon-files -d %U

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

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

Add this content and save:

[Contractor Entry]
Name=Make executable
Description=Make a file 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]
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