Stop GNOME changing default application for file type.

  • Double click any JPEG in Nautilus and it opens in GNOME Image Viewer.
  • Right click a JPEG in Nautilus select “Open With Another Application”.
  • Select GIMP. JPEG is opened in GIMP.
  • Close GIMP.
  • Double click any JPEG in Nautilus and it opens in GIMP.
  • Say swear words. Just because I opened one JPEG In GIMP one time doesn’t mean I now want all JPEGS to open in GIMP by default.

How do I stop the above happening? The behaviour occurs with a newly created user. This annoying behaviour doesn’t happen in Fedora and I can’t find anyone else talking about. I’m wondering if it’s an openSUSE specific thing.

A quick test confirmed that SLED12 SP3 and Ubuntu 16.10, both with Gnome, behave the way you expect.
So there seem to be something unique to Leap, even 42.2, but I’m nor smart enough to find out.

If you go into System Settings -> Details and set the ‘Default Application’ for Photos it should stay at eg Shotwell Viewer even when you open an individual item with another application.

Good tip Malcolm, but odd behaviour anyway.
Default app for photos already was “Image Viewer”, but it didn’t stick. Changed that to “GIMP”, then back to “Image Viewer” and now it does stick.
I guess, unless you explicitly choose one application as default the system just picks the first “recommended application” but doesn’t consider it as “default” actually?
And SLED doesn’t need that trick as far as I witnessed here.

A few more tests shed some light on the matter…
Created a fresh user. The file ~/.config/mimeapps.list does NOT exist.
Opening a .jpeg file, the first app in alphabetical order is offered (in my case, Darktable) but since mimeapps.list does not exist, this is not actually a “default app” for jpeg.
Choosing another app to open the .jpeg (say, eog AKA “Image Viewer”) creates a mimeapps.list file BUT its content is as follows:

[Added Associations]

So, since eog.desktop is now an “added association”, “Image Viewer” is now called upon “double click” on a .jpeg file. But please note, there is NO “[Default Applications]” section yet, so “Image Viewer” is NOT a default yet and so doesn’t stick.
When you follow Malcolm’s advice or select a .jpeg file, CTRL+I, “Open With” tab, select GIMP (say) and “Set as default”, then select “Image Viewer” and “Set as default” again, now you see in mimeapps.list:

[Default Applications]

Now “Image Viewer” is indeed THE default application and will stick as such until explicitly set otherwise.

Maybe other distros (including SLED apparently) have another way to set sensible defaults even when the user mimeapps.list doesn’t explicitly list them as such.

The annoying behaviour is gone! :smiley:

Thank you both, for the method of the fix and the detail. I’m told I “must spread some Reputation around” before giving it to either of you again else I would do that.

As I said, I’m not smart enough, but I keep trying :wink:
According to Gnome docs system-wide default apps are defined by one of the following two files:
I find the first one in my test Ubuntu 16.10 and that may explain while there the default apps behave as expected even if a single user didn’t set them explicitly.
I find no such files in various (open)SUSE installs I have at the moment, but… there is a:
in openSUSE Leap42.2, SLED12 SP3, Tumbleweed-Gnome (actually checked an old 20170322 snapshot with Gnome 3.24).
Apparently, that file does its job in SLED and Tumbleweed, but not so in Leap 42.2 (nor 42.3 according to the OP). Is that file not parsed in Leap?

So what we suggested in this thread is a workaround, but there is definitely something wrong in Leap.
I’ll join in testing if somebody is interested enough to file and follow up a bug report.