[Gambas-user] Get the default file manager

Bruce Steers bsteers4 at gmail.com
Sun Feb 18 12:11:28 CET 2024


On Sun, 18 Feb 2024 at 11:07, System64 Development <64xcode at gmail.com>
wrote:

> El 18/2/24 a las 06:12, Bruce Steers escribió:
> > that's 5 programs that have FileManager as a category.
> > and my default file manager caja is not one of them.
> > caja is one of the results but it has no categories set.
>
> I understand.
>
> Do you have something called caja.desktop, or something similar, in the
> /usr/share/applications/ directory?
>
> Where does DesktopMime get its information from ? the
> /usr/share/applications/ directory or the
> /home/<USER>/.config/mimeapps.list file ?
>
> What I think is happening on your system is that in one of the two
> places there is no "Caja", which one is it, you tell me.
>
> Best regards.
>
> Martin
>

I have no idea.
But still there was no way to tell from the list of the other FileManager
category apps what one was my default.
xdg-mime seems to do a much better job of getting the default than
gb.desktop can.

This seems pretty robust and does what you want :)

  Dim sDFile As String
  Shell "echo -n $(xdg-mime query default inode/directory)" To sDFile
  Dim hDF As DesktopFile = New DesktopFile("/usr/share/applications" &/
sDFile)
  hdf.Run(User.Home)

Respects
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20240218/00b49087/attachment-0001.htm>


More information about the User mailing list