GNOME Bugzilla – Bug 532474
"File Management Preferences - Media" should allow arbitrary commands
Last modified: 2008-07-29 21:41:15 UTC
the bug has been opened on https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/227162 "Because of the issues with DVD playback in totem-gstreamer, I have totem-xine installed as well. I want to be able to set my system to play DVDs using totem-xine when they're inserted. This should be as easy as setting a command of "totem-xine dvd://" or similar in the Media tab of Nautilus's File Management Preferences, but that option does not exist."
I'm not sure this is a Nautilus bug, as we ask for the applications supporting the "x-content/video-dvd" mimetype to build the application list. CC-ing Bastien, as this might be a bug in Totem.
That's a packaging issue, not a Totem or nautilus one. If there are 2 binaries, then there should be 2 .desktop files, or an easier way to switch between them. This was done in Fedora using the 2.23.x version with a different shared library for the different backends. FWIW, the "example" command-line you mentioned won't even work.
This doesn't cover just the "make totem-xine the default DVD player" use case. In GNOME 2.20, it was possible to have an arbitrary command executed upon media automounting, but in 2.22, with Nautilus handling the automounting, the "Media" tab was removed from gnome-volume-properties (bug #509823), and this option is no longer there. Some users want it back.
the issue is not specific to some applications so don't focus on the example there, some users seem to be expecting to be able to give random arguments or use a custom command there
CC-ing David.
(In reply to comment #3) > This doesn't cover just the "make totem-xine the default DVD player" use case. > In GNOME 2.20, it was possible to have an arbitrary command executed upon media > automounting, but in 2.22, with Nautilus handling the automounting, the "Media" > tab was removed from gnome-volume-properties (bug #509823), and this option is > no longer there. Some users want it back. That's not a good reason to add it back, having the ability to run random commands in gnome-volume-manager was because it wasn't well designed, and the whole mess stemmed from magicdev doing something similar. If you have a use case that fits in better with the request, I'm pretty sure we can solve it in a different way. Simply adding back a text entry certainly isn't a good design decision, and it won't be happening. So please provide a better use case for the problem, and feel free to reopen the bug.
I want to run an arbitrary shell script when one of these events happens. How do I do that? Is your answer really that I should create the various MIME magic files and register them? If so, do you have some documentation on how I might do that?
(In reply to comment #2) > FWIW, the "example" command-line you mentioned won't even work. For the record, it really does. I tried it before filing the bug and I just tried it again now.
(In reply to comment #8) > (In reply to comment #2) > > FWIW, the "example" command-line you mentioned won't even work. > > For the record, it really does. I tried it before filing the bug and I just > tried it again now. It won't work with multiple drives, and only works because you've used the same drive to play something before. The right way would be "totem file:///path/to/dvd/mount/point".
I would like to run an arbitrary script as well (specifically a python script to process my .scrobbler.log on my Rockbox player and submit the tracks to last.fm). I like to then launch Amarok manually later but I would like this to be automated. It seems to me that what with my case and similar ones, people wanting to run applications with specific arguments, and others that might arise, the text field should just be put back. That way, when someone runs into one of these problems, and they know how to use commands, they can just use the text field, without running all over the net like I've been doing for the past 30min.
> the text field should just be put back No, we're not going to put the text field back. But we might do something like what we do for ordinary MIME associations, e.g. "Open with Other Program" in the file manager if you click a file. So the drop down menu would look like this Ask what to do Do nothing Open in Folder -------------- Open Audio CD Extractor Open Rhythmbox -------------- Open with Other Program So if you select "Open with Other Program" you'd get a dialog like this http://people.freedesktop.org/~david/nautilus-add-app.png The $64,000 question is now how to remove that program once you've added it. Maybe it's automatically removed when you select one of the defaults (e.g. "Audio CD Extractor" and "Rhythmbox").
While I do think its good to make Gnome simple and therefore accessible this really comes across as out of hand. This reminds me of not allowing to set options for screensavers. This is really bizarre. Some kind of huge barrier in understanding perspectives is happening between the developers and the users. This comes across as developers who don't want the program used in ways they can't imagine. And with something like Nautilus which is really meant to be an invisible program that just puts you in touch with the workings of your computer - that is just crazy. There is no reason why a user should be expected to invent a "legitimate" reason to run a program that isn't automagically found. There is every reason to expect that it won't work perfectly sometimes. The clean design idea of this is wrong. Design that is dysfunctional is a mess, even if its a perfect white cube! I understand the technical side is a different matter. What it takes to make these suggestions happen is no small feat and we are greatful. But taking function away (from the users perspective) is not helpful. My suggestion would be to make it instead like the right click nautilus scripts folder. That way things can be added and removed cleanly and function is ultimate but design can also be.
(In reply to comment #12) > While I do think its good to make Gnome simple and therefore accessible this > really comes across as out of hand. The rest of the rant is utter crap. Create a .desktop file with the right mimetypes being handled, and it will show up as a handler for the types you mention. Not adding (back) an entry (which was only requested as a knee-jerk reaction) is a design decision and the right thing to do. People that want something more complicated for themselves can create .desktop files (just like for screensavers).
Sorry if this is redundant, but I am trying to follow this discussion to fix the problem for myself. In my case, I want to switch the default DVD player to VLC, on a user-by-user basis. From what I infer from this discussion, the VLC package maintainer must somehow register VLC with Gnome as a handler for MIME type "x-content/video-dvd", that this is done by setting the MimeType field in the application's .desktop file, and this will somehow be picked up by Gnome at login. Is this correct? If not, what is the correct procedure? There can exist more than one .desktop file per executable. How does Gnome decide which .desktop file has the "correct" set of MimeTypes, or is it a union? Where does the .desktop file have to exist to be read? Can a user put one somewhere in his home directory? If so, where? This is important, because my users each want to chose their own default player. I tried adding x-content/video-dvd to the MimeType field of the vlc.desktop file in /usr/share/applications, and I restarted Gnome, but it did not put VLC in the drop-down of DVD players in the Nautilus preferences media tab. What else am I missing? Finally, so far I have found only one working method to make VLC the default DVD player. It is shown in this thread: http://ubuntuforums.org/showthread.php?t=770970 However, this is a global system default, and so is not an acceptable solution. For the record, I like the solution proposed in comment #11; it seems the easiest to use from the end user's perspective.
(In reply to comment #11) > > the text field should just be put back > > No, we're not going to put the text field back. But we might do something like > what we do for ordinary MIME associations, e.g. "Open with Other Program" in > the file manager if you click a file. ... > So if you select "Open with Other Program" you'd get a dialog like this > > http://people.freedesktop.org/~david/nautilus-add-app.png This sounds like a wonderful way to deal with it. > The $64,000 question is now how to remove that program once you've added it. > Maybe it's automatically removed when you select one of the defaults (e.g. > "Audio CD Extractor" and "Rhythmbox"). That seems good enough. If it's not, let the people that need more suggest an alternative.
(In reply to comment #11) > No, we're not going to put the text field back. But we might do something like > what we do for ordinary MIME associations, e.g. "Open with Other Program" in > the file manager if you click a file. So the drop down menu would look like > this > > Ask what to do > Do nothing > Open in Folder > -------------- > Open Audio CD Extractor > Open Rhythmbox > -------------- > Open with Other Program > > So if you select "Open with Other Program" you'd get a dialog like this > > http://people.freedesktop.org/~david/nautilus-add-app.png Great. That would probably solve most of people's problems, including mine if the custom command option is kept. > The $64,000 question is now how to remove that program once you've added it. > Maybe it's automatically removed when you select one of the defaults (e.g. > "Audio CD Extractor" and "Rhythmbox"). How about right click -> remove
Can this please be re-opened to track the suggestion in comment #11?
OK, reopened, we should do something like what comment 11 says. Personally, I don't have a lot of time right now for hacking on Nautilus but I'll try to do this for 2.24...
as a gnome user, i just want to disagree vehemently with comment 6. the ability to run a random script when a cd or other media loads is hardly bad design, it's a substantive feature that offers real benefits to the user. Until 2.22, i ran a custom script when inserting an audio cd: it ripped the cd to flac and mp3, synced the files to the appropriate archives, and ejected the disc. This *tremendously* simplified the work of moving my cd collection to hard disc, and I bragged extensively to my friends about how great gnome and linux were, in thatt they allowed me this flexibility which they would all be denied by their non-free operating systems. now of course this is nearly impossible to figure out. ok, i can write a .desktop file for my little script, but it took a lot of web searching to figure that out. I don't really see how one can argue that the earlier behaviour is more broken than the current behaviour. so add a vote for changing back to the way things were.
ps, in fact, it's not obvious to me that i *can* write a .desktop file for my script -- i just tried doing that and nothing came up in my restarted nautilus. i'm a pretty advanced user, but these operations are pretty opaque to me, and i'm feeling an urge to just throw up my hands in despair. less advanced users are likely to do so earlier, and again, i don't see how that should be interpreted as a good thing.
(In reply to comment #14) > Where does the .desktop file have to exist to be read? Can a user put one > somewhere in his home directory? If so, where? This is important, because my > users each want to chose their own default player. > Good question - is there a document somewhere on this or can someone give the answer in the mean time?
> Good question - is there a document somewhere on this or can someone give the answer in the mean time? At the moment, the following MIME types are available [1]: x-content/audio-player (portable audio players) x-content/audio-cdda (Audio CD) x-content/blank-dvd x-content/blank-hddvd x-content/blank-bd (blank BlueRay disc) x-content/blank-cd x-content/image-dcf (medium containing DCIM or dcim folder) x-content/video-dvd (medium containing VIDEO_TS folder) x-content/audio-dvd (medium containing AUDIO_TS folder) x-content/video-svcd (medium containing SVCD, EXT or MPEG-2 folder) x-content/video-vcd (medium containing VCD or MPEGAV folder) x-content/video-bluray (medium containing BDAV or BDMV folder) x-content/video-hddvd (medium containing HVDVD_TS folder) x-content/image-picturecd (medium containing PICTURES folder) x-content/software (medium containing autorun.exe, autorun.inf, .autorun, autorun or autorun.sh folder) Now, here is a walkthrough: 1. You need a media handler. For installing a handler for video DVDs, VCDs and CDs, you'd have to write a .desktop file according to the FreeDesktop Desktop Entry specification [2]. [Desktop Entry] Encoding=UTF-8 Type=Application Name=My DVD Handler MimeType=x-content/video-dvd;x-content/video-vcd;x-content/audio-cdda; Exec=my-executable %U Upon execution, %U will be replaced an URI describing the resource. For audio CDs (CDDA), it would be "cdda://scd0". I am not sure whether these are actually standardized. This file has to be put to /usr/share/applications/my-handler.desktop (for all users) or ~/.local/share/applications/my-handler.desktop (for one user). 2. You have to refresh your application directory cache Run update-desktop-database if you installed it for all users or update-desktop-database ~/.local/share/applications if you installed it for one users 3. Associate the application with the medium type Either use nautilus-file-management-properties or edit ~/.local/share/applications/mimeapps.list [1] http://svn.gnome.org/viewvc/nautilus/trunk/libnautilus-private/nautilus-autorun.c?annotate=14266#l587 [2] http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html
Just wanted to add my voice to the concern that really a command box is required. You can hide somewhere in an "add application" menu if your design principles are being violated by having out where people might actually see it, but please, please just give back the ability to run custom commands without complicated .desktop stuff. Otherwise, it's just making a simple task unnecessarily complicated, all in the name of design (a name which, I might add, generally infers making a complicated task simple). An "add application menu", no matter how well designed or cleanly made will invariably miss something that is required by some users. I don't feel this is sufficient to really cover all use cases.
*** Bug 545200 has been marked as a duplicate of this bug. ***
I also miss this feature, for example, I want to launch gxine for DVD playback, but I can't as gxine doesn't provide a desktop file with proper MimeType and using command "gxine dvd:///(device)"
Just wanted to mention that I'm right now working adding a "Open with other application..." item to the dialog. Will send the patch to the nautilus-list later today.
(In reply to comment #19) > Until 2.22, i ran a custom script when inserting an audio cd: it ripped the cd > to flac and mp3, synced the files to the appropriate archives, and ejected the > disc. This *tremendously* simplified the work of moving my cd collection to > hard disc... I think what you really want for this use case is a way of suppressing the default mime type handling system while your special "rip CDs en masse" program is running. For example, it makes sense for Sound Juicer to do this.
(In reply to comment #27) > (In reply to comment #19) > > > Until 2.22, i ran a custom script when inserting an audio cd: it ripped the cd > > to flac and mp3, synced the files to the appropriate archives, and ejected the > > disc. This *tremendously* simplified the work of moving my cd collection to > > hard disc... > > I think what you really want for this use case is a way of suppressing the > default mime type handling system while your special "rip CDs en masse" program > is running. > > For example, it makes sense for Sound Juicer to do this. > Right. There should probably be some mechanism for that. But that's a separate bug (please Cc david@fubar.dk when filing it and I'll look at it for 2.26).
Here's the mail with the patch http://mail.gnome.org/archives/nautilus-list/2008-July/msg00094.html Here's a screenshot http://people.freedesktop.org/~david/nautilus-x-content-other-app.png
(In reply to comment #29) > http://people.freedesktop.org/~david/nautilus-x-content-other-app.png > and when selecting "Open with other Application..." a dialog like this appear http://people.freedesktop.org/~david/nautilus-add-app.png
This looks ok :-D Thanks
Committed: 2008-07-29 David Zeuthen <davidz@redhat.com> * configure.in: Require gio 2.17.5 for g_mount_guess_content_type(). * data/nautilus.xml.in: Delete x-content/* definitions; these are in shared-mime-info 0.50 and greater. * libnautilus-private/nautilus-global-preferences.c: * libnautilus-private/nautilus-global-preferences.h: * libnautilus-private/apps_nautilus_preferences.schemas.in: Remove /apps/nautilus/preferences/media_autorun_x_content_ask and add /apps/nautilus/preferences/media_autorun_x_content_start_app instead since we're inverting the logic. Now, by default (except for x-content/software for which we're shipping an app ourselves) we default to asking the user what action to take. * libnautilus-private/nautilus-autorun.c: * libnautilus-private/nautilus-autorun.h: Use g_mount_guess_content_type() instead of using our own sniffing code. Also provide an option for the user to select an application to use (#532474). * src/nautilus-file-management-properties.c: Catch up with API changes to nautilus_autorun_prepare_combo_box()