As a packager, can you prevent a program from taking over as default for file associations?
Per the title, is it possible to ensure a program can't take over as the default application for file types? My experience is strictly with KDE4 (on 14.2), so I'm not sure if this is specifically a KDE issue or something within the OS itself.
Background I'm the maintainer of mediainfo. When I install this package (with the GUI=yes option), mediainfo-gui becomes the default application for several different file types (I've changed the defaults on my system, so I couldn't tell you which ones). This also happens with MusicBrainz's picard, taking over aac, ac3 and midi. I also noticed that EasyTag has become the default application for flac and mp3. I know I can change the defaults back, but it seems that there should be a way to prevent certain programs from ever being default (assuming another program is already registered to the system). I don't think anyone would ever want to double click a media file and have mediainfo open up (especially when it adds an entry to the context menu). I maintain both mediainfo and picard on SBo and I'd love to be able to add something to the resulting packages to make sure I'm not mucking up with people's file associations. Any ideas? |
So the culprit seems to be this command
Code:
if [ -x /usr/bin/update-desktop-database ]; then From the manpage: Code:
The update-desktop-database program is a tool to build a cache database of the MIME types handled by desktop files... For example, gvim.desktop contains the following Code:
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; To answer your question, you could try disabling that command in the doinst.sh and see what happens. |
Disabling the command won't help in the long run because the next install of any desktop application will run it again. Unless you disable it in all software using GUI, that is.
A better approach would be creating Override.xml as described in the Shared MIME info specification. Or overriding the system MIME defaults via files in ~/.local/share/mime/ and/or /usr/local/share/mime/ because they take higher precedence. |
Just right click the file and look at permissions..."Opens With"
DONE. All files with that suffix will open with that program selected. KDE ? Dunno. Never will |
Maybe if the Gates desktop environment gives a fit you could sudo dolphin in the terminal ?
|
The idea that the computer could correctly guess which program the user wants to run on a file was doomed from the beginning.
If you are writing software, I recommend avoiding the MIME database. Ed |
Quote:
Quote:
Quote:
From my albeit limited understanding, MIME databases are still handy for GUI apps and to let users know what programs are able to open what. However, I was just hoping there was some setting to state that you don't want to have a program become a default over other existing programs. I don't foresee anyone installing EasyTag would want that to open up by default when they double-click on an mp3, yet that's what happened on my system after installing it. I then needed to go through and adjust the default program back to my original program. |
[ Sorry, just realised that you are looking for something to add at a package level... please ignore the noise from here ]
Maybe try using a file ~/.config/mimeapps.list ? This is what I set up for my students so that things open in the expected programs. This is using XFCE, so it's possible it might not work under KDE. Here is my default example: (Where there are two options listed, the first one is the default) Code:
[Default Applications] |
Quote:
But your post might help someone searching for how to do it on their end... Thanks for keeping it! |
Quote:
Determining what is the default application for a given MIME type is managed by KDE via mimeapps.list. See this question at SE. The file is searched in this order: Code:
~/.config/kde-mimeapps.list |
Quote:
Ed |
Quote:
Based on this thread, it seems that as a packager, I'll just have no control over this and it'll be up to users to change it back if the system decides to change things. That's unfortunate. Quote:
|
Quote:
At this point, I can't provide more help with MIME or KDE because I do not use them. One motivation for creating my own system was that I have a lot of file types that MIME and file sniffers don't recognize. The user (me) knows exactly what they are. Ed |
Quote:
However, there's no reason to do that in a WM/DE. When you double click on an mp3, you expect it to play in a program. If you want to see what other programs may be available to play the file, you can right click and see what's in the "Open with" submenu. A MIME database is key to this functionality. Anyway, my post was not to debate the positives or negatives of a MIME database. I simply wanted to know if it's possible for a packager to prevent their package from taking over defaults when a user installs it. If you want to keep debating whether people should use MIME databases, please open a new thread to discuss it. Thanks! :) |
Quote:
Code:
xdg-mime query default audio/mp3 Code:
xdg-mime query default audio/mpeg BTW, Code:
xdg-mime default org.kde.amarok.desktop audio/mpeg |
All times are GMT -5. The time now is 05:33 PM. |