You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An approach I've seen many projects (such as rofi) take for plugins, which I'm a huge fan of, is loading dynamic libraries in a certain directory (could be the config dir for example).
Ghostty could utilize this as a way for advanced users to configure their terminal.
Why this makes sense
Ghostty already has many of its types being C-compatible (for libghostty and the macOS apprt). This would mean that this is pretty low-effort to implement.
Users may be more comfortable writing Zig or C than Ghostty's own configuration format. I myself had trouble staring at configuration lines that were giving me an error, unable to figure out why (yes, that's a separate problem, but the general point still holds :D).
Keybinds could be given custom callbacks (function pointers) to do essentially anything.
This would elegantly fix API for managing windows / tabs / splits #601 — such a config, or perhaps plugin is a better word, could implement some wire protocol, but that might not even be necessary depending on the use case.
Export relevant symbols and create headers (this is probably done already). A Zig client library could also be considered, but this isn't really a must.
Discover plugins: search for dynamic library files (Linux: .so, Windows: .dll, macOS: no idea). This could just be the config directory, but also a subdirectory or somewhere entirely different.
For each library - note that Zig has abstractions for both dlopen and dlsym (see: std.DynLib):
dlopen it (need to dlclose on shutdown)
Load and call some well-defined entry point symbol from it using dlsym. This could be ghostty_plugin_open, for example.
Plugins can now call into ghostty's API to do whatever.
An approach I've seen many projects (such as rofi) take for plugins, which I'm a huge fan of, is loading dynamic libraries in a certain directory (could be the config dir for example).
Ghostty could utilize this as a way for advanced users to configure their terminal.
Why this makes sense
How to implement this
.so, Windows:.dll, macOS: no idea). This could just be the config directory, but also a subdirectory or somewhere entirely different.dlopenanddlsym(see:std.DynLib):dlopenit (need todlcloseon shutdown)dlsym. This could beghostty_plugin_open, for example.