Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

In System Settings --> Details --> Removable Media there are drop downs to let you select what to do when you insert various media types.

I've written some scripts called things like ripmovie and put them in /usr/local/bin

They work from the command line correctly.

I want them to be available as options in the drop down that appears when you insert a DVD movie.

I've tried selecting "Other Application" but they're not in the list and you can't add new ones.

How can I do that?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I toiled and toiled, and I finally found out how to do this!

Create a file that looks like this. Using your example script, name it ripmovie.desktop and place it in /usr/local/share/applications/ or ~/.local/share/applications/.

[Desktop Entry]
Name=RipMovie
Comment=Rip movies
Keywords=Video;Movie;Film;DVD;Disc;Rip
Exec=/usr/local/bin/ripmovie %f
Terminal=true
Type=Application
Categories=GTK;GNOME;AudioVideo;Video;
MimeType=x-content/video-dvd;
StartupNotify=true

Not all of the pieces of this are necessary, but the ones that are include the Name, the Exec, the Terminal line, and most importantly, the MimeType! That is the piece of magic that System Settings is looking for!

I found that I had to play with the end of the Exec line. Check out the spec of .desktop files. I wound up just hard-coding my optical drive (/dev/sr0) in there to pass to my script. If I ever get multiple drives, I'll worry about it then.

share|improve this answer
    
OK, now THAT'S awesome. Every other thing I've seen is some hideous udev config, which is outside of where I want it (in the user account's scope, not system wide). –  RoboJ1M Nov 26 '13 at 10:15
    
Is there a mime type for an audio cd? –  RoboJ1M Dec 25 '13 at 12:39
    
@RoboJ1M Yes, it is x-content/audio-cdda. FYI, my answer does not fully work in 14.04 for me. I had to fiddle with ~/.local/share/applications/mimeapps.list to get it working. –  Cliff May 26 at 0:27
    
And I think the real, final answer may have something to do with xdg-desktop-menu. I'll have to play with it some more. –  Cliff Jul 31 at 17:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.