What would be the content of a
.contract file in /
usr/share/contractor for a menu entry like 'Mount iso'?
gnome-disk-utility I already had Open With > Disc Image Mounter in context menu and a
gnome-desk-image-mounter.desktop file in
/usr/share/applications. Looking into that, I have created a
.contract file that works with the same consequence (and so is a bit pointless, adding nothing, although answers the question):
sudo gedit /usr/share/contractor/mount_iso.contract
[Contractor Entry] Name=Mount Icon=drive-removable-media Description=Mount ISO file MimeType=application/x-cd-image;application/x-raw-disk-image Exec=gnome-disk-image-mounter %f Terminal=false StartupNotify=false Type=Application NoDisplay=true X-Ubuntu-Gettext-Domain=gnome-disk-utility
Just like with Disc Image Mounter, the image is not yet mounted, but added to the file manager sidebar list of drives and mounted from there
Can't guarantee that it'll work, but something along the lines of this:
[Contractor Entry] Name=Mount ISO Icon=ubiquity Description=Mount ISO file to /mnt MimeType=application/iso-image Exec=pkexec mount -o loop %f /mnt
- icons are found at
/usr/share/icons/elementary. You can just put the appropriate name in.
- the exec part is the relevant one. pkexec uses polkit to authorize an action that will require administrative privileges, such as using mount. If you want to put more effort into it, you may be able to use GNOME's mounting services to mount without using your password.
%fwill be replaced by the file's path.
- since a contract only gets a file as argument, you can't specify the location. So you must either invoke a dialog (cheap solution would be a bash-invokable program like
zenity) to ask for the location or use a default one, like
- Maybe check the mime type, I don't have an ISO file handy to check it right now. Just right click and go to properties to find out.