.desktop files with [Desktop Entry]: MimeType etc.

Post tutorials, HOWTO's and other useful resources here.
rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

.desktop files with [Desktop Entry]: MimeType etc.

Post#1 by rych » 19 Sep 2022, 10:59

We sometimes need to make a .desktop file to integrate an App into a Start menu and so on. Or, to edit an existing one.

For example, right now I'm trying to make VLC player to open a whole folder by editing the /usr/share/applications/vlc.desktop I've prepended a inode/directory; on the appropriate (?) line as follows:

Code: Select all

MimeType=inode/directory;application/ogg...
However VLC does not show in the right click context menu in SpaceFM for a folder. Interestingly, the "mpv Media Player" is there, yet if we look at the mpv.desktop there is no mentioning of the word "directory" -- it's a mystery how it appears in the list then.

Once I figure this out (help appreciated) I'll add the instruction here and it'd make a nice "tutorial" :)

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3924
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

.desktop files with [Desktop Entry]: MimeType etc.

Post#2 by ncmprhnsbl » 19 Sep 2022, 12:00

rych wrote:
19 Sep 2022, 10:59
However VLC does not show in the right click context menu in SpaceFM for a folder. Interestingly, the "mpv Media Player" is there, yet if we look at the mpv.desktop there is no mentioning of the word "directory" -- it's a mystery how it appears in the list then.
couple of things: after editing a /usr/share/applications/*.desktop, run (as root) update-desktop-database to update /usr/share/applications/mimeinfo.cache

alternatively, take a look at ~/.config/mimeapps.list ..for openbox/spacefm, it looks like this:

Code: Select all

[Default Applications]
inode/directory=spacefm.desktop;mpv.desktop;pcmanfm-create-module.desktop;pcmanfm-create-zstd-module.desktop;

[Added Associations]
inode/directory=spacefm.desktop;mpv.desktop;pcmanfm-create-module.desktop;pcmanfm-create-zstd-module.desktop;
adding vlc.desktop should work , as presumably it works for mpv.. this can be done from spacefm's rclick menu too under Open with>choose(or smthing like) ...other filemanagers are similar.. give or take.. sometimes under properties..
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

.desktop files with [Desktop Entry]: MimeType etc.

Post#3 by rych » 20 Sep 2022, 09:08

ncmprhnsbl wrote:
19 Sep 2022, 12:00
couple of things
Fantastic. It actually appeared after reboot -- but no need, as we can update-desktop-database. (I tried running update-mime-database /root/.local/share/mime; update-mime-database /usr/share/mime without success before)
ncmprhnsbl wrote:
19 Sep 2022, 12:00
alternatively, take a look at ~/.config/mimeapps.list
-- an interesting alternative, right now vlc.desktop doesn't appear there, indeed it seems to be a separate special list and explains why mpv.desktop has been included for folders without claiming the corresponding MimeType (exactly inode/directory and not x-directory/normal or anything else) inherently.

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3924
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

.desktop files with [Desktop Entry]: MimeType etc.

Post#4 by ncmprhnsbl » 20 Sep 2022, 10:10

rych wrote:
20 Sep 2022, 09:08
Fantastic. It actually appeared after reboot -- but no need, as we can update-desktop-database.
yeah, update-desktop-database also gets run when activating(and deactivating) modules too..
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

Post Reply