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
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.

> 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:
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:
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
.desktop files with [Desktop Entry]: MimeType etc.
Posted: 16 Apr 2025, 12:16
by rych
ncmprhnsbl, once again I need your expert advice. I use Obsidian (AppImage) and when asked to open files or folders in external default system Apps, it either opens wrong Apps or does nothing. I'm reporting it at the Obsidian community but there no answer from them:
https://forum.obsidian.md/t/open-in-sys ... es-vscode/ :
Code: Select all
oot@porteus:~# xdg-mime query default inode/directory
spacefm.desktop
root@porteus:~# /I/Obsidian.AppImage --no-sandbox
Setting $HOME to /I/Obsidian.AppImage.home
Setting $XDG_CONFIG_HOME to /I/Obsidian.AppImage.config
2025-04-14 12:15:37 Loading main app package /tmp/.mount_Obsidi4WLtOM/resources/obsidian.asar
[5230:0415/001538.202733:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.StartServiceByName: object_path= /org/freedesktop/DBus: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.portal.Desktop exited with status 127
MESA-INTEL: warning: Haswell Vulkan support is incomplete
2025-04-14 12:15:38 Checking for update using Github
libva error: /usr/lib64/dri/iHD_drv_video.so init failed
2025-04-14 12:15:38 Success.
2025-04-14 12:15:38 Latest version is 1.8.9
2025-04-14 12:15:38 App is up to date.
[5230:0415/001541.338416:ERROR:atom_cache.cc(229)] Add WM_CHANGE_STATE to kAtomsToCache
[5230:0415/001635.935695:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.portal.OpenURI.OpenDirectory: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.portal.Desktop exited with status 127
[5230:0415/001635.935710:ERROR:platform_util_linux.cc(242)] Error calling OpenDirectory
[5504:0415/001636.496723:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.StartServiceByName: object_path= /org/freedesktop/DBus: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.portal.Desktop exited with status 127
Warning: 'unity-launch' is not in the list of known options, but still passed to Electron/Chromium.
This behavior of Obsidian maybe exposing some unorthodox ways of (my setup of) Porteus. For example, right clicking on a pdf file in the vault, “Open in default app” opens it in Xournal++. Granted, it can display PDFs and maybe once I set it up as a default, but now I have other pdf viewers as default. And so on. The funniest external App being launched by Obsidian is VS Code as a "System explorer"

Maybe because VS Code and Obsidian use the same chromium/Electron or whatever.
All this only if you use Obsidian yourself -- if not maybe it's too irrelevant for you to take a look.
.desktop files with [Desktop Entry]: MimeType etc.
Posted: 18 Apr 2025, 01:45
by ncmprhnsbl
rych wrote: ↑16 Apr 2025, 12:16
your expert advice.

not sure i have any of that
so.. obsidian i haven't used (maybe i should, to be better organized), but from a quick look, i see some possible issues...
1. being an electron app ; 2. also being an appimage ...one of or both of those relying on xdg-desktop-portal to do the dbus/xdg stuff to connect with the system..
and with appimages, sometimes relying on some peculiarity of the build host (generally ubuntu)
what might be interesting, would be to see how it behaves in a "proper desktop environment" like gnome or plasma (or even cinnamon or xfce4)
.desktop files with [Desktop Entry]: MimeType etc.
Posted: 19 Apr 2025, 11:32
by rych
ncmprhnsbl, Thanks, indeed the solution is to use their .deb package, and NOT the .AppImage: now Obsidian correctly opens external system default apps.