Re: g_app_info_launch_default_for_uri



Hi Jeff,

On Wed, May 06, 2020 at 05:17:42PM +0200, Jeff via gtk-perl-list wrote:
Hi Martin,

On 05/05/2020 15:02, Martin Mézl wrote:
This should work:

  use Glib; # But Glib is not necessary here
  use Glib::IO;

  # Glib::Object::Introspection is not needed

  my $uri = Glib->filename_to_uri($file, undef); # undef => no hostname
  my $context = Glib::IO::AppLaunchContext->new;

  Glib::IO::AppInfo::launch_default_for_uri($uri, $context);

Oh yes. Very nice, thanks.

Using $uri = 'mailto:x@y', I can start an email client.

How can I add an attachment without resorting to xdg-email?

You can't: mailto URIs only allow header fields¹, which attachments are
not, see https://tools.ietf.org/html/rfc6068#section-2

best regards,

¹ And you can't expect parsers to understand more than a few, as stated
latter on the same RFC.
-- 
  Ricardo Mones 
  ~
  Don't take the name of root in vain.          /usr/src/linux/README

Attachment: signature.asc
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]