[Gambas-user] Desktop.Open, new portal method breaks computer:/// and trash://

Benoît Minisini benoit.minisini at gambas-basic.org
Sun Dec 10 23:08:50 CET 2023


Le 10/12/2023 à 22:51, Bruce Steers a écrit :
> 
> 
> On Sun, 10 Dec 2023 at 21:10, Benoît Minisini 
> <benoit.minisini at gambas-basic.org 
> <mailto:benoit.minisini at gambas-basic.org>> wrote:
> 
>     Le 10/12/2023 à 22:07, Bruce Steers a écrit :
>      > new Portal method for Desktop.Open breaks compputer:/// and trash:///
>      >
>      > it works the old xdg way.
>      > I modified Desktop.Open to look like this...
>      >
>      > Static Public Sub {Open}(Url As String, Optional {Wait} As Boolean)
>      >
>      >   Dim XDGOnly As Boolean = Url = "computer:///" Or Url = "trash:///"
>      >
>      >    Url = File.RealPath(Url)
>      >
>      >    If DesktopPortal.Enabled And If Not XDGOnly Then
>      >      DesktopPortal.OpenURI(Url)
>      >    Else
>      >      Main.RunXdgUtil("xdg-open", [Url], {Wait})
>      >    Endif
>      >
>      > End
>      >
>      >
>      > Respects
>      > BruceS
>      >
> 
>     It's not a solution as:
> 
>     - 'xdg-utils' scripts are deprecated.
> 
>     - AFAIK, no standard says something about "computer://" and "trash://".
> 
>     -- 
>     Benoît Minisini.
> 
> 
> from what i can tell it's gio that supports the standard... (not that i 
> know anything about gio it's just xdg will report a gio error for a non 
> existent name)
> 
> $ gio info computer:///
> display name: Computer
> name: /
> type: directory
> uri: computer:///
> attributes:
>    standard::type: 2
>    standard::name: /
>    standard::display-name: Computer
>    standard::icon: computer, computer-symbolic
>    standard::content-type: inode/directory
>    standard::symbolic-icon: computer-symbolic, computer
>    id::filesystem: computer:
>    access::can-write: FALSE
>    access::can-delete: FALSE
>    access::can-trash: FALSE
>    metadata::annotation:
>    metadata::caja-icon-view-auto-layout: true
>    metadata::caja-icon-view-tighter-layout: false
>    metadata::nemo-icon-view-auto-layout: true
> 
> also seems to be a recent:///
> Cannot seem to find any specification/standard list of others though :(
> 
> Respects
> BruceS
> 

It's what I wanted to say.

'xdg-utils' just sends the URL to a command-line tool associated with 
the current desktop. Then that command-line tool interpretes that URL in 
its own way.

I don't know what the desktop portal documentation says about the URLs, 
bug I guess there is no desktop portal implementation that implements it 
the same way. :-/

And I don't want to write my own abstraction of that stuff now - like 
you started to do by adding your two tests at the beginning of 
'Desktop.Open()'.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list