This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Manage file associations

Tags: None
(comma "," separated)
pandiloko
Registered Member
Posts
17
Karma
0

Manage file associations

Mon Aug 08, 2022 3:24 pm
I have a problem with file associations. Some applications have the bad habit of register themselves as a possible application to open a file with. But they do it for EVERY effing file type! I had this happened in the past with (wait for it) Internet Explorer through Wine!! but also with Thunderbird (to send the file attached) and even with Skype (to share any file).

This means that any file without a proper application associated gets opened with Internet Explorer, Thunderbird or Skype. Sometimes these applications position themselves at a higher position than the appropriate program. I checked right now and for example Thunderbird is the default choice for ogg, wmv or 3gp with VLC being in the second or even third position (after the likes of Firefox and Skype!!).

This is completely madness. My question is:

- Is it possible to prevent this from happening?
- How can I batch-manage the associations?? I would like to be able to at least eliminate the wrong ones and for example associate all video types to VLC and things like that.

Apparently I'm not alone but this old thread doesn't propose a solution:

viewtopic.php?f=17&t=163547&p=425405&hilit=file+association#p425405

Please help! Thanks in advance.
dzon
Registered Member
Posts
493
Karma
3

Re: Manage file associations

Mon Aug 08, 2022 4:48 pm
Files and the associated applications are managed in the system settings>applications>file associations. And, unless you set a default application, then yes, it'll open with something you don't want. https://imgur.com/a/37juyZK


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
pandiloko
Registered Member
Posts
17
Karma
0

Re: Manage file associations

Mon Aug 08, 2022 11:43 pm
dzon wrote:Files and the associated applications are managed in the system settings>applications>file associations. And, unless you set a default application, then yes, it'll open with something you don't want. https://imgur.com/a/37juyZK


Sorry, perhaps I didn't explain myself clearly. I know where to change the file associations but unless I'm no using the dialog correctly there is no way of bulk-modify an entire group (e.g. all video types). It would be a real pain to change every association to see them change again because another application decides it is going to open every file type.

Also while we are at it: send as attachment or share a file should be actions instead of full-fledged file type associations.

I'm guessing maybe this is difficult to change from KDE perspective and the culprit is actually the application itself but it would be nice to be able to bulk-modify the file type associations.
dzon
Registered Member
Posts
493
Karma
3

Re: Manage file associations

Tue Aug 09, 2022 9:32 am
Ah, okay. Well....no. It's still not possible in kde ( I know, beats me). What you'd ( and probably many more ) want is something like this https://imgur.com/a/bv584TH.
It's not available. I guess the closest you can do is something like "xdg-mime default vlc.desktop video/mp4". I know some people wrote scripts to achieve it, but yeah, it should be implemented in default applications.
The stuff is set in ~/.local/share/applications in the mimeinfo.cache. https://imgur.com/a/YOglFzk


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
pandiloko
Registered Member
Posts
17
Karma
0

Re: Manage file associations

Tue Aug 09, 2022 10:46 am
Thanks for your efforts. The file you indicated was almost empty. Just 3 lines with some outdated info. I think $HOME/.config/mimeapps.list seems to be more relevant but I didn't play with it yet so I'm not sure.
dzon
Registered Member
Posts
493
Karma
3

Re: Manage file associations

Tue Aug 09, 2022 12:06 pm
The mimeinfo.cache gets updated by the .desktop associations. The cache will write everytime an application is assigned to a mimetype.


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
pandiloko
Registered Member
Posts
17
Karma
0

Re: Manage file associations

Tue Aug 09, 2022 2:48 pm
Well IDK. Maybe my system has some problem but my ~/.local/share/applications in the mimeinfo.cache was last modified on March or something like that whereas ~/.config/mimeapps.list is modified whenever I change the associations on the GUI and click on the "Apply" button.

But anyway thanks again for pointing me in the right direction. I think I'm going to give it a go and put together a simple script to bulk-fix the wrong associations and set some sane defaults.
pandiloko
Registered Member
Posts
17
Karma
0

Re: Manage file associations

Wed Sep 14, 2022 3:37 pm
So I finally did some changes in the mimeapps.list and had some peace for a while. Now Firefox has its own mime configuration apparently which doesn't follow KDE's configuration. Kinda.

It opens plain text files (text/plain;charset=utf-8) with Azure Data Studio (ADS). After some investigation I found out there wasn't a default text/plain application configured in Firefox so it somehow made the conclusion that ADS was the best candidate.

Upon analyzing the ADS's deb file I found that it indeed registers itself somewhere as text/plain application candidate:

Code: Select all
[Desktop Entry]
Name=Azure Data Studio
Comment=Data Management Tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.
GenericName=Text Editor
Exec=/usr/share/azuredatastudio/azuredatastudio --no-sandbox --unity-launch %F
Icon=com.azuredatastudio
Type=Application
StartupNotify=false
StartupWMClass=azuredatastudio
Categories=Utility;TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;application/x-azuredatastudio-workspace;
Actions=new-empty-window;
Keywords=azuredatastudio;

[Desktop Action new-empty-window]
Name=New Empty Window
Exec=/usr/share/azuredatastudio/azuredatastudio --no-sandbox --new-window %F
Icon=com.azuredatastudio



Now I have a couple of questions. Why is Firefox not following DE's settings? Why can Azure Data Studio register itself as text/plain application? There are many other candidates (actual text editors) installed before it.

But first and foremost: this is probably not KDE's problem, is it? Where should I go to complain about this outrage?

And finally: Why am I the only one complaining. I mean, I'm not alone. I found lots of stackoverflow and similar sites but somehow not many people seem to be bothered and IMHO this is pretty annoying. Anyway thanks for any feedback.
pandiloko
Registered Member
Posts
17
Karma
0

Re: Manage file associations

Wed Sep 14, 2022 3:53 pm
Right after writing the last post I found out why is Firefox being so stupid. It just picks the first choice alphabetically from /usr/share/applications/*desktop, which in my case happens to be azuredatastudio.desktop. As soon as I remove that file it jumps to the next, which just by chance is code.desktop (VSCode) which is an acceptable choice. So yes, totally Firefox's fault. Probably the only way to fix it is setting a default application in Firefox settings.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, mickae, Sogou [Bot]