Skip to content

GTK: use portals to open URLs instead of xdg-open #5991

Description

@jcollie

Did you see https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.OpenURI.html? Seems like we should use that and then fallback to xdg-open.

Originally posted by @tristan957 in #5988 (comment)

Activity

  1. jcollie commented on Feb 25, 2025

    @jcollie
    MemberAuthor

    I'm wondering if we should have a "global" indicator on the GTK App structure to indicate if portals are in use on the system running Ghostty. I'd prefer not to repeat the "slowness" accusations that we had because we were using a synchronous dbus call to get the system theme. With a global like that we could failover fast to calling xdg-open.

  2. added theissue type on Feb 25, 2025
  3. tristan957 commented on Feb 26, 2025

    @tristan957
    Member

    I'm wondering if we should have a "global" indicator on the GTK App structure to indicate if portals are in use

    How would you determine that?

  4. jcollie commented on Feb 26, 2025

    @jcollie
    MemberAuthor

    I'm wondering if we should have a "global" indicator on the GTK App structure to indicate if portals are in use

    How would you determine that?

    That I'm not sure about yet. Probably send a query to the portal at app init and if we don't get a response or get an error set the indicator to false.

  5. tristan957 commented on Feb 26, 2025

    @tristan957
    Member

    I don't think people are going to complain about their open_url taking a few milliseconds longer ðŸĪ·

  6. jcollie commented on Feb 26, 2025

    @jcollie
    MemberAuthor

    I don't think people are going to complain about their open_url taking a few milliseconds longer ðŸĪ·

    On some people's systems it takes seconds for the DBus call to timeout instead of erroring out nearly instantly. That's why we had problems with the dark/light detection when we went public. Don't care to repeat that. Just saying that this will take some investigation.

  7. tristan957 commented on Feb 26, 2025

    @tristan957
    Member

    I don't think people are going to complain about their open_url taking a few milliseconds longer ðŸĪ·

    On some people's systems it takes seconds for the DBus call to timeout instead of erroring out nearly instantly. That's why we had problems with the dark/light detection when we went public. Don't care to repeat that. Just saying that this will take some investigation.

    I'm pretty sure libadwaita already has a synchronous dbus call in the init path, fyi

  8. mitchellh commented on Jul 7, 2025

    @mitchellh
    Contributor

    I don't think people are going to complain about their open_url taking a few milliseconds longer ðŸĪ·

    It doesn't have to be synchronous. You can kick off an asynchronous call, and if you get an open URL request in the mean time you can fallback to xdg-open. It's highly unlikely someone will open a URL that fast (and in the case of a timeout, you'd eventually fallback there anyways).

    (Edit: I mean adding portal detection on the initial path. But I haven't done research yet to see if there is a better way to detect it)

  9. added this to the 1.3.0 milestone on Aug 25, 2025
  10. modified the milestones: 1.3.0, 1.4.0 on Feb 22, 2026
  11. added a commit that references this issue on Mar 23, 2026
    374ed27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions