elementary / switchboard-plug-applications

Switchboard Applications Plug
https://elementary.io
GNU General Public License v3.0
14 stars 12 forks source link

Default Apps change randomly #164

Closed tudorjnu closed 3 years ago

tudorjnu commented 3 years ago

What Happened

The default applications change randomly from time to time. The current setup of apps is Vivaldi web browser, Pictures and Evolution. However, I often open a picture and it randomly goes into the web browser to find out that the default app has randomly changed. Sometimes it gets even worse and it tries to open email with Pictures, internet with Pictures.

Steps to Reproduce

I am not too sure of a standard steps that would create a similar situation but my guess is more of a clash between the apps.

Platform Information

abodedis commented 3 years ago

I have this issue as well, in which default applications may change randomly, and even when attempts are made to change them back, it will not remember the changes.

You may be able to work around this by going to Files, right clicking on a file of the file type that opened incorrectly, Open With -> Select Other Application -> Set as Default. For me, this worked for Images at least.

tudorjnu commented 3 years ago

Thanks, that seemed to have stabilised it a little. I guess that for now I would just chose default apps per extension basis. :)

itoshkov commented 3 years ago

I have this issue as well, in which default applications may change randomly, and even when attempts are made to change them back, it will not remember the changes.

Are you using Vivaldi as well?

jeremypw commented 3 years ago

There are only five places in elementary code where the default application for a type is changed: see https://github.com/search?q=org%3Aelementary+set_as_default_for_type&type=code. Only two places make general changes - the Files app and the Switchboard Applications plug. Both require user interaction. So I am not sure what is going on here - especially if the changes are truly random. If any pattern can be discerned please report as it could give a clue.

itoshkov commented 3 years ago

For me the pattern is, that Email Client and Image Viewer are both set either to Photo Viewer or to Mail. At the moment I don't use the Mail client, but I do use the Photo Viewer. I'm not sure when this happens, but I mostly see it when I try to open a picture from Files and it opens in Mail. But right now I checked the default apps and they are both set to Picture Viewer.

I'm not sure if the bug is in elementary OS at all. I'm also using Vivaldi for browsing and it is the default browser. It can also be set as email client and image viewer.

itoshkov commented 3 years ago

Sorry for the spam, but I decided to play a little bit more. First of all, I exited the browser, to reduce the chance it's doing something in the background.

I opened the settings and saw this: Screenshot from 2021-09-05 21 42 43

Next, I fixed the email client to be Mail: Screenshot from 2021-09-05 21 43 09

I closed the Settings program, reopened it and saw this: Screenshot from 2021-09-05 21-43-23

If I now change the image viewer and exit the settings, it will also change the email client.

jeremypw commented 3 years ago

I have reproduced this to the extent that changing the "Mail" default app also changes the "Calendar" default app to the same app. Also the "Web Browser" and "Image Viewer" apps seem to change together. I could see anything obvious in the plug code that would cause this so I am wondering whether it is an upstream issue to do with using AppInfo.set_default_for_type ()

jeremypw commented 3 years ago

I think what is happening is that when an app gets set as default for one mime-type, it is getting set as default for all the mime-types it supports. So most web-browsers will support image mime-types as well as web-page mime-types (see MimeType key in their .desktop file). I'll try and look into it further.

jeremypw commented 3 years ago

Looking at the code again, it seems that when the default app is changed, all the mime-types that the original default supported are mapped to the new app. Not sure when or why this was done :shrug:

stradicat commented 3 years ago

Can confirm; bitmap images were suddenly reassigned from Photo Viewer ("Visor de Imágenes") to Chrome...

... and when reassigning images to Photo Viewer...

...the default web browser is also reassigned to Photo Viewer.

kem-a commented 3 years ago

I just wanted to confirm this bug. For me random circulation of default apps is between Web browser, Email client and Image viewer. Other seems to stay stable. Also, sometimes default apps are selected entirely wrong, like VLC player for Image viewer.

Edit: It seems that function On_Change or something similar wrongly attributes default apps for those three positions, because if you change default apps in gnome-settings then all stays correct until change is done in elementary settings.