February 9, 2014

Add Open As Root To Pantheon Files

You can add these options in the Files menu :



To do so right click Files in Plank and open New Window As Administrator.
Navigate to /usr/share/contractor.
Right click and Create New File > Empty File with the following content :
[Contractor Entry]
Name=Open folder as root
Icon=pantheon-files
Description=Open current folder as root privilege
MimeType=inode;
Exec=gksudo pantheon-files %U
Gettext-Domain=pantheon-files


Save the file as folder-openasroot.contract

If you copy and paste the content, make sure to make an extra keystroke e.g. hitting Space at the end of the last line. Otherwise the content will not be saved if auto-save is checked ( Scratch > Preferences > Save files when changed ). This a known bug.

For Open file as root create a new file in /usr/share/contractor with the following lines :
[Contractor Entry]
Name=Open file as root
Icon=scratch-text-editor
Description=open file as root with scratch
MimeType=text
Exec=gksudo scratch-text-editor %U
Gettext-Domain=scratch-text-editor


Save the file as scratch-openasroot.contract.

4 comments:

  1. Nice post! I didn't know you could do such things like this within the elementary pantheon-files app. I just created two contract files to integrate deja-dup backup and restore tool into pantheon-files. I always loved the feature that Gnome had with it's Deja-dup integration in to Nautilus and wanted to get the same in ElementaryOS. Now I have it and it's awesome.

    ReplyDelete
    Replies
    1. I've used these contractor files for months. I found it at http://elementaryforum.org/

      Delete
  2. So these contractor files are like .desktop ones? Good to know.

    ReplyDelete
  3. I had to change 'gksudo' to 'sudo' for this to work.

    ReplyDelete