Page 1 of 1

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

Posted: 19 Sep 2022, 10:59
by rych
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" :)

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

Posted: 19 Sep 2022, 12:00
by ncmprhnsbl
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..

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

Posted: 20 Sep 2022, 09:08
by rych
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.

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

Posted: 20 Sep 2022, 10:10
by ncmprhnsbl
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..

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

Posted: 11 Jun 2024, 12:33
by rych
ncmprhnsbl, I think I need your help again about this topic please

When in SpaceFm, under root, I double-click on a binary executable ( application/x-executable ), or a shell script ( application/x-shellscript )... it prompts me to choose an Application or Command from a list. That list doesn't simply doesn't contain the Execute command so can't set it as a default for these files from now on

I have to right-click and choose the first entry from the context menu which is precisely the Execute command I want with the 2 cogs icon -- and it runs.

How do I make that a default action on a double-click?


I've looked at
ncmprhnsbl wrote:
19 Sep 2022, 12:00
take a look at ~/.config/mimeapps.list ..for openbox/spacefm
but it does not mention any application/x-executable or application/x-shellscript

Perhaps, such a convenience is forbidden for root?!

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

Posted: 11 Jun 2024, 16:15
by tome
hello rych, add executable permissions to these files.

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

Posted: 12 Jun 2024, 10:34
by rych
tome wrote:
11 Jun 2024, 16:15
executable permissions
are already set of course. That's what I mean by
rych wrote:
11 Jun 2024, 12:33
and it runs
-- eventually runs when I choose the "Execute" entry from the context menu. In fact, I've just removed the "executable permissions" from the file, and now the entry "Execute" isn't even in the context menu. So, SpaceFM does recognize the file as executable. It just doesn't offer a way to set "Execute" as a default action. For years now I've had to right clikc and choose "Execute" from there, and I'm tired of this extra step. Want to just run on a double-click, would be more natural.

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

Posted: 14 Jun 2024, 01:33
by ncmprhnsbl
rych wrote:
12 Jun 2024, 10:34
It just doesn't offer a way to set "Execute" as a default action.
:D > spacefm > view > preferences > interface > "clicks run executable" > :tick:

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

Posted: 14 Jun 2024, 10:17
by rych
ncmprhnsbl wrote:
14 Jun 2024, 01:33
> spacefm > view > preferences > interface > "clicks run executable" > :tick:
Wow! So simple and so ...GUI, indeed other File managers were actually working, and now with that tick SpaceFm does too. Thanks :) (Maybe I'm getting old)

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

Posted: 14 Jul 2024, 07:39
by rych
Another issue about .desktop files is that SpaceFM and probably some other FMs don't know how to handle Type=Link .desktop files (anymore?)

For example, make a simple google.desktop file as follows:
[Desktop Entry]
Encoding=UTF-8
Icon=text-html
Type=Link
Name=Google
URL=https://www.google.com
Double click and instead of bringing up the browser and opening the URL, it says:
Error: Command not found
That's a standard way to make url file links and it used to work in the past. I have Firefox extensions creating links of that type. SpaceFM is just expected to:

Code: Select all

xdg-open https://www.google.com
Why not?

Same error if one wanted to make local Windows-style shortcut with the Type=Link .desktop file with a URL=file:///home. Nope. I could only make it work to explicitly include Exec filed. So, if we want to jump to /home folder, the only way so far is to make a home.desktop file as follows:
[Desktop Entry]
Exec=xdg-open /home
Icon=emblem-symbolic-link
On double-click SpaceFM opens that folder in a new tab. But I wish it understood Type=Link .desktop shortcuts, both local and internet.

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

Posted: 14 Jul 2024, 14:53
by Ed_P
Apparently Link is not a valid Porteus category, use Type=Application.

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

Posted: 15 Jul 2024, 01:19
by ncmprhnsbl
yeah, according to this, (although it seems to be incomplete) https://wiki.archlinux.org/title/Desktop_entries#Usage only kde plasma supports Type=Link