Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
insert new destop file to first in mimeinfo.cache?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
guyuming
Apprentice
Apprentice


Joined: 19 Nov 2020
Posts: 235

PostPosted: Sat Jun 03, 2023 3:43 am    Post subject: insert new destop file to first in mimeinfo.cache? Reply with quote

I created an ebuild file to install my customized file manager with associated .desktop file, which contains MimeType=inode/directory;

and i called update-desktop-database in ebuild file.

The problem is, /usr/share/applications/mimeinfo.cache file contains more than one .desktop files for inode/directory,

Code:
inode/directory=git-cola-folder-handler.desktop;org.gnome.baobab.desktop;ranger.desktop;rfm.desktop;


and i find that the first app is launched(git-cola-folder-handler in my case).

After my ebuild is emerged, my rfm.destop is appended to the last.

So, is it possible to have update-desktop-database to insert newly installed desktop file to the first in MimeType list in mimeinfo.cache?
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1877
Location: Switzerland (Romandie)

PostPosted: Thu Jun 15, 2023 11:50 pm    Post subject: Reply with quote

On freedesktop.org: Adding MIME Tutor
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1897
Location: 127.0.0.1

PostPosted: Fri Jun 23, 2023 6:05 pm    Post subject: Reply with quote

Quote:

So, is it possible to have update-desktop-database to insert newly installed desktop file to the first in MimeType list in mimeinfo.cache?


The goal of mimeinfo.cache file is not to prioritize applications.
In your desktop environment (not as root), if you think that a specific MimeType should be opened with a specific application, then you should edit your ~/.config/mimeapps.list ¹.
Usually, there are tools integrated in your desktop environment to do it visually (in Xfce, right click on a file --> Properties -> Open with), but you can also do it with a command line tool : xdg-mime.

List of applications handling application/pdf mimetype :
Code:

$ grep 'application/pdf' ~/.config/mimeapps.list
application/pdf=qpdfview.desktop;zzz-gimp.desktop;mupdf.desktop;org.gnome.Evince.desktop;firefox-bin.desktop;


Default application used :
Code:

$ xdg-mime query default application/pdf
firefox-bin.desktop


Overriding :
Code:

$ xdg-mime default mupdf.desktop application/pdf


PDF files will now open with mupdf :
Code:

$ xdg-mime query default application/pdf
mupdf.desktop


If you want to override default application system-wide, then you want to create/edit /etc/xdg/mimeapps.list in the same way.
There is also a distribution-provided file (theorically this one should be installed/edited by an ebuild) : /usr/share/applications/mimeapps.list

1. https://wiki.archlinux.org/title/XDG_MIME_Applications#mimeapps.list
2. https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum