You are not logged in.

#1 2013-02-13 14:41:39

silasdavis
Member
Registered: 2013-02-13
Posts: 16

xdg (or Gnome 3) default applications

I want to change the default applications for certain files as determined by xdg, in this case under cinnamon/gnome 3 but I want it to apply across all DEs implementing freedesktop.org standards.

I have emacs and gvim installed. They both have .desktop files in /usr/share/applications/ which specify their mimetype associations. I happen to have installed emacs after vim, and now I have /usr/share/applications/mimeinfo.cache which seems to be generated from the other files, with lines like, for example:

text/plain=emacs.desktop;gvim.desktop;

Which I assume causes emacs to be selected as the default plain text editor (as indeed it is by xdg-mime query default text/plain shows).

I have three questions:

1. How can I change the default text editor without editing mimeinfo.cache (I assume it is auto-(re)generated) and without removing emacs' mime types (which are correct and should stay)?
2. How do I regenerate mimeinfo.cache?
3. Is there a GUI that allows me to do this stuff (ideally without having to find a file of a particular type to open first - I have tried in Gnome 3: 'System Settings > Details > Default Applications' and there are only a few default 'application types' there, not mime types, and none of them is text editor)?

Offline

#2 2013-02-13 14:57:06

Kilz
Member
Registered: 2008-03-01
Posts: 140

Re: xdg (or Gnome 3) default applications

The Wiki usually has the best info But the easiest way is to find a file of the type to open, then right click on it, select properties, then click on the "Opens With" tab and select an application to set as default. That will set what opens that type of file.

Last edited by Kilz (2013-02-13 14:58:30)


I trust Microsoft about as far as I can comfortably spit a dead rat.
Cinnamon is a wonderful desktop
"Faith is the substance of things hoped for, the evidence of things not seen."

Offline

#3 2013-02-13 15:00:58

silasdavis
Member
Registered: 2013-02-13
Posts: 16

Re: xdg (or Gnome 3) default applications

With reference to: http://standards.freedesktop.org/deskto … 01s07.html

In answer to 1:

It seems the preferences are handled 'externally', and although it doesn't make it clear where it seems to be in /usr/share/applications/defaults.list, I edited min

[Default Applications]
x-scheme-handler/spotify=spotify.desktop
text/plain=gvim.desktop

(in answer to 2:)
I then ran 'sudo update-desktop-database'

And now:

$ xdg-mime query default text/plain
gvim.desktop emacs.desktop

But I'm still interested in the answer to 3, in particular a tool that would change groups of supported mime types and allow you to pick and choose from the lists defined per applications would be useful...

Offline

#4 2013-02-13 15:07:53

silasdavis
Member
Registered: 2013-02-13
Posts: 16

Re: xdg (or Gnome 3) default applications

@Kilz yeah that article looked a bit of a mess - it doesn't really introduce the .desktop files/general principle if you needed to know.

I tried adding a /usr/share/applications/mimeapps.list like it suggests:

[Added Associations]
text/plain=gvim.desktop

[Removed Associations]

removing my entry from defaults.list and re-running update-desktop-database

As it says it seems this is not implemented properly (even by the xdg tool?), because now:

$ xdg-mime query default text/plain
emacs.desktop

Weird that I don't get a preference list from xdg-mime now, because it is there.

Offline

#5 2013-02-13 15:14:34

silasdavis
Member
Registered: 2013-02-13
Posts: 16

Re: xdg (or Gnome 3) default applications

More... ~/.local/share/applications/mimeapps.list exists, but [Added Associations] sections in that file seem to have no effect.

However, this:

[Default Applications]
text/plain=gvim.desktop
text/html=chromium.desktop
x-scheme-handler/http=chromium.desktop
x-scheme-handler/https=chromium.desktop
x-scheme-handler/about=chromium.desktop
x-scheme-handler/unknown=chromium.desktop

Does work per user.

Clearly the spec/implementations aren't very stable yet

Offline

#6 2013-02-13 15:31:06

progandy
Member
Registered: 2012-05-17
Posts: 2,151

Re: xdg (or Gnome 3) default applications

3. Is there a GUI that allows me to do this stuff (ideally without having to find a file of a particular type to open first - I have tried in Gnome 3: 'System Settings > Details > Default Applications' and there are only a few default 'application types' there, not mime types, and none of them is text editor)?

xfce4 has a mime type editor which is part of xfce4-settings (The binary is called xfce4-mime-settings).
It should work with gnome, too since it modifies the sections "Default Assosiactions" and "Added Associations" in ~/.local/share/applications/mimeapps.list

Last edited by progandy (2013-02-13 15:32:46)

Offline

#7 2013-02-13 18:34:23

silasdavis
Member
Registered: 2013-02-13
Posts: 16

Re: xdg (or Gnome 3) default applications

Thanks for that - just what I was after (well some form of multi/hierarchical set would be nice too) - good old xfce.

xfce4-mime-settings is actually adding the selected default to both the [Default Applications] and the [Added Associations] sections. I suspect this is for compatibility with things not following the spec. Also the applications I have tried do not seem to be using the generated cache.

Also on closer inspection it seems that it is xdg-mime query that is not following the spec. Applications, like xfce4-mime-settings and rabbitvcs, *do* actually respect the [Added Associations] in /usr/share/applications/mimeapps.list even though xdg-mime returns 'emacs.desktop' when I query text/plain after having added 'text/plain=gvim.desktop' - the applications seem to work.

Offline

#8 2014-01-22 12:02:20

thens
Member
Registered: 2013-10-29
Posts: 14

Re: xdg (or Gnome 3) default applications

I'm missing sth like the xfce4' mime editor in gnome3 as well, albeit one can of course edit the corresponding files manually.
However, it'd be preferable to have a graphical application for selecting/setting default applications for "non-power users".

Offline

Board footer

Powered by FluxBB