Repository navigation
core/gtk: open urls using an apprt action instead of doing it directly - #5988
Conversation
|
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. |
mitchellh
left a comment
There was a problem hiding this comment.
Thanks for starting this, I can take a look for libghostty.
20f4b88 to
4dde6f4
Compare
That looks interesting but I'd rather take that on in a follow-up PR after this is merged. |
d339ac3 to
0a69243
Compare
0a69243 to
70af7a1
Compare
7e852df to
aa8e7f2
Compare
1568fd7 to
7fafa50
Compare
daa12b3 to
7a0028a
Compare
7a0028a to
83d5127
Compare
tristan957
left a comment
There was a problem hiding this comment.
Would open_uri be a better name than open_url?
83d5127 to
fe996ca
Compare
fe996ca to
3b66483
Compare
Is this something you've considered? Maybe I'm blind. |
TIL that xdg-open uses the portal already, so I wonder if there is any benefit to using the portal directly vs just calling xdg-open. Maybe lower overhead? |
Yeah, you could avoid the thread spawn and fork/exec in Ghostty, but that's pretty minimal since I doubt that it's going to be called thousands of times per second. The benefit of calling |
|
I've updated the PR to rebase on top of #7657 so there's no special "open on linux" function anymore. This still needs a macOS implementation of the |
|
Actually, I just realized that |
So then, I think my position will continue to be prioritize the portal with an xdg-open fallback (future work). Thanks for your research. |
|
Hm, I guess I have a question. Why does libghostty do the physical opening. Why isn't it left to the apprt? Meaning the macOS apprt would run |
The |
c6821f6 to
ad845dc
Compare
Partial implementation of ghostty-org#5256 This implements the core changes necessary to open urls using an apprt action rather than doing it directly from the core. Implements the open_url action in the GTK and GLFW apprts. Note that this should not be merged until a macOS-savvy developer can add an implementation of the open_url action for the macOS apprt.
ad845dc to
70a2a0a
Compare
|
|
||
| const log = std.log.scoped(.@"os-open"); | ||
| const apprt = @import("../apprt.zig"); | ||
| const CircBuf = @import("../datastruct/circ_buf.zig").CircBuf; |
There was a problem hiding this comment.
On a future note, your PRs have a pattern of containing unrelated changes such as this. I'm going to revert all the circular buffer stuff. It makes sense but conflating the purpose and goal of a PR makes review harder and makes things like reverting uglier if we ever to. I'd appreciate keeping things tightly scoped.
|
Okay, I made it so that if the apprt doesn't support this we fallback to our old implementation. This will let us merge this without worrying about macOS. I'll make a follow up issue for that. Once CI passes we're good. |
Partial implementation of #5256
This implements the core changes necessary to open urls using an apprt action rather than doing it directly from the core.
Implements the open_url action in the GTK apprt.
Note that this should not be merged until a macOS-savvy developer can add an implementation of the open_url action for the macOS apprt.