[Gambas-user] Get the default file manager

Bruce Steers bsteers4 at gmail.com
Fri Feb 16 13:09:12 CET 2024


On Fri, 16 Feb 2024 at 11:55, Bruce Steers <bsteers4 at gmail.com> wrote:

> Sorry I was clearly not paying attention and for some reason thought text
> editor :-\
>
> Seems using the same method for mime type inode/directory does not work :(
>
> BruceS
>

xdg-mime works okay...

xdg-mime query default inode/directory

will get the .desktop file that launches the file manager in
/usr/share/applications.

cat /usr/share/applications/$(xdg-mime query default inode/directory)| grep
Exec

TryExec=/usr/bin/caja
Exec=/usr/bin/caja --no-desktop %U

BruceS





>
> On Fri, 16 Feb 2024 at 11:45, Bruce Steers <bsteers4 at gmail.com> wrote:
>
>> you could use DesktopMime to get the first listed application
>>
>> Print DesktopMime["text/plain"].GetApplications()[0].Exec
>>
>> or..
>> For Each df As DesktopFile In DesktopMime["text/plain"].GetApplications()
>>   Print df.Name, df.Exec
>> Next
>>
>> Prints......
>>
>> Pluma   pluma %U
>> Emacs (GUI)     /usr/bin/emacs %F
>> FeatherPad      featherpad %U
>> jEdit   jedit %U
>> LibreOffice Writer      libreoffice --writer %U
>> Okular  okular %U
>> Text Editor     gedit %U
>> Kate    kate -b %U
>> KWrite  kwrite %U
>> Mousepad        mousepad %U
>>
>> Respects
>> BruceS
>>
>>
>>
>> On Fri, 16 Feb 2024 at 11:39, System64 Development <64xcode at gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I was using Desktop.Open(Path) to open the directory of the shrimp
>>> projects but now this statement opens the ide, I guess because at some
>>> point I opened a shrimp project from the file manager and the system
>>> "memorized" this action.
>>>
>>> Anyway, how can I get the name of the default application that manages
>>> the files? in my case it is Thunar because I use XFCE but what is the
>>> general way?
>>>
>>> Best regards.
>>>
>>> Martin.
>>>
>>>
>>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20240216/798cda1e/attachment-0001.htm>


More information about the User mailing list