After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 532474 - "File Management Preferences - Media" should allow arbitrary commands
"File Management Preferences - Media" should allow arbitrary commands
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: [obsolete] GIO
2.22.x
Other Linux
: Normal enhancement
: ---
Assigned To: David Zeuthen (not reading bugmail)
Nautilus Maintainers
: 545200 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-05-10 12:30 UTC by Sebastien Bacher
Modified: 2008-07-29 21:41 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Sebastien Bacher 2008-05-10 12:30:49 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."
Comment 1 Cosimo Cecchi 2008-05-10 13:15:01 UTC
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.
Comment 2 Bastien Nocera 2008-05-10 13:56:19 UTC
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.
Comment 3 Murat Güneş 2008-05-10 14:00:25 UTC
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.
Comment 4 Sebastien Bacher 2008-05-10 14:03:21 UTC
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
Comment 5 Cosimo Cecchi 2008-05-10 14:05:23 UTC
CC-ing David.
Comment 6 Bastien Nocera 2008-05-10 16:03:19 UTC
(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.
Comment 7 Richard Laager 2008-05-10 22:13:16 UTC
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?
Comment 8 Richard Laager 2008-05-10 22:14:58 UTC
(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.
Comment 9 Bastien Nocera 2008-05-12 14:23:57 UTC
(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".
Comment 10 Matthew 2008-05-15 05:45:52 UTC
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.
Comment 11 David Zeuthen (not reading bugmail) 2008-05-16 14:20:34 UTC
> 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").

Comment 12 spam 2008-05-16 21:19:32 UTC
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.
Comment 13 Bastien Nocera 2008-05-16 23:03:42 UTC
(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).
Comment 14 rlange 2008-05-20 07:23:03 UTC
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.
Comment 15 Richard Laager 2008-05-20 15:41:14 UTC
(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.
Comment 16 Matthew 2008-05-28 01:50:38 UTC
(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

Comment 17 Richard Laager 2008-06-02 16:08:40 UTC
Can this please be re-opened to track the suggestion in comment #11?
Comment 18 David Zeuthen (not reading bugmail) 2008-06-02 16:35:36 UTC
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...
Comment 19 Matt Price 2008-06-05 04:23:12 UTC
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.  
Comment 20 Matt Price 2008-06-05 04:30:01 UTC
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.  
Comment 21 David Fraser 2008-06-28 20:06:26 UTC
(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?
Comment 22 Christian Neumair 2008-06-28 21:59:32 UTC
> 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
Comment 23 Jeffrey Theobald 2008-07-28 16:40:30 UTC
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. 
Comment 24 A. Walton 2008-07-28 18:45:52 UTC
*** Bug 545200 has been marked as a duplicate of this bug. ***
Comment 25 Pacho Ramos 2008-07-28 20:07:50 UTC
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)"
Comment 26 David Zeuthen (not reading bugmail) 2008-07-29 15:55:56 UTC
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.
Comment 27 Colin Walters 2008-07-29 16:10:27 UTC
(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.
Comment 28 David Zeuthen (not reading bugmail) 2008-07-29 16:15:34 UTC
(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).
Comment 29 David Zeuthen (not reading bugmail) 2008-07-29 19:10:22 UTC
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
Comment 30 David Zeuthen (not reading bugmail) 2008-07-29 19:11:33 UTC
(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
Comment 31 Pacho Ramos 2008-07-29 19:48:05 UTC
This looks ok :-D Thanks
Comment 32 David Zeuthen (not reading bugmail) 2008-07-29 21:41:15 UTC
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()