-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quick terminal on Linux #4624
Comments
(sorry if this comment belongs in a discussion thread instead)
Guake works on my Gnome+Wayland system, so |
Guake is GTK3, though. GTK4 removed a LOT of APIs that allow windows to position themselves (since that is something Wayland explicitly forbids), so I doubt their approach still works |
After looking at the gtk4-layer-shell docs, I realize that it's not exactly the best solution for us — not only does it mean even more C code (yikes) it also has its own Wayland register roundtrip logic which is terribly redundant. I think writing the glue ourselves shouldn't be that bad, given a) how small the API is in reality (and how many of them are simple wrappers around existing Wayland protocols) and b) we can use Zig for a large part of the Wayland interface code thanks to zig-wayland, which should be a lot easier than trying to write raw C. |
Going to capture this since it came up in the Discord: Looking at prior art with ddterm, which bundles the terminal within a whole plugin, or with another plugin which attempts to do the same, this could set some direction on how to tackle this within GNOME. It'd likely need to be something that isn't directly bundled with Ghostty but could be offered as an addition to the platform, since GNOME's native approach is to use plugins. Simply put, this appears to be the "workaround" that GNOME has to go through in order to place arbitrary windows of varying width and height on the screen. Doesn't have to be an option today, but could be revisited when libghostty is released. |
Looks like reimplementing I... am not down for patching and overriding symbols inside dynamic libraries. We should probably try doing something else (if an alternative exists). |
Ugly. I'd say us Gnome users just lose out until hell freezes over and Gnome implements the layer shell. |
This isn't even just exclusive to GNOME — it's GTK being GTK 😛 |
So a big FU from Gnome to everyone else too, huh? |
Some related issues on upstreaming the needed changes to gtk:
I'm imagining another (probably not practical) way to proxy between an output top-level window to a layer-shell window. Create the layer-shell window by other means without gtk, and imagine it as a mini compositor for the gtk app window (all private to the same process). The gtk app will get a wayland display socket, and the idea is to have some minimal wayland proxy/server code translates things over. Or maybe there's a way to do that without a proxy by just rendering to texture? |
That sounds technically feasible I guess (basically making a relay that's both a client and a server simultaneously and pointing GTK at the relay server, which allows the relay to filter requests) but I'd have to think more about it. It sounds like something that maybe someone has made before though. |
Interestingly, firefox bundles it's own thin wayland proxy which is only 733 loc of C++. I wonder if something around this level of complexity is possible:
Various other references I have for either proxies or self hosted compositors that may be educational or have bits to copy:
|
Here's a bit of a toy POC: https://gist.github.com/digitalsignalperson/9f6bc16ba1954c40cb61ca4babc8c419
Jankyness:
Adding to references of interest: wlroots has a nice example of a layer-shell client https://gitlab.freedesktop.org/wlroots/wlr-clients/-/blob/master/layer-shell.c but idk if there is a way with gtk4 to render to something "offscreen" and deal with passing inputs Also thought wofi was a good reference until I realized it was gtk3 |
Also noticed that gtk4-layer-shell is an official package in almost all major distros. Seems like a kind of accepted solution despite the method of overriding functions |
As discussed in #4361, it appears that we could implement the quick terminal on Linux if we make use of the wlr-layer-shell protocol.
For our specific use case as a GTK4 application, however, we might also consider an off-the-shelf, battle-tested solution such as gtk4-layer-shell instead as to reduce the burden of maintaining our own Wayland glue code (at the cost of introducing a new dependency, of course).
A perhaps ironic downside to this is that GNOME users won't be able to use this, though the stubbornness of GNOME developers is scantly our fault...
The text was updated successfully, but these errors were encountered: