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.
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.
ReplyDeleteI've used these contractor files for months. I found it at http://elementaryforum.org/
DeleteI had to change 'gksudo' to 'sudo' for this to work.
ReplyDeletethat script works on Elementary Os Loki to add "open folder as root" option via "pkexec"
ReplyDeletecreate a contractor entry:
sudo touch /usr/share/contractor/folder-openasroot.contract && gksudo scratch-text-editor /usr/share/contractor/folder-openasroot.contract
then edit it like that:
[Contractor Entry]
Name=Open folder as root
Icon=pantheon-files
Description=Open folder as root
MimeType=inode;
Exec=pantheon-files-pkexec %U
Gettext-Domain=pantheon-files" > /usr/share/contractor/openasroot.contract
and then via terminal run that command:
>sudo sh -c 'echo "#!/bin/sh
pkexec \"/usr/bin/pantheon-files\" \"\$@\"" > /usr/bin/pantheon-files-pkexec'
that's all. It's done!