[Gambas-user] Get the default file manager

Bruce Steers bsteers4 at gmail.com
Fri Feb 16 13:24:54 CET 2024


This maybe....

Dim sApp As String
Shell "xdg-mime query default inode/directory" To sApp  ' Getr .desktop
file name of filemanager launcher.

Dim aLines As String[] = Split(File.Load("/usr/share/applications" &/
RTrim(sApp)), "\n") ' Read it and split the lines.

sApp = Mid$(aLines[aLines.Find("Exec=*", gb.like)], 6)  ' Find the Exec=
line and get the command

Print sApp   ' Print the command

Prints...
/usr/bin/caja --no-desktop %U

Respects
BruceS


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

>
>
> 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: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/8b2e6000/attachment.htm>


More information about the User mailing list