mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-17 09:01:23 +00:00
core: add function to get process info from the surface
This adds a function to the core surface to get process information about the process(es) running in the terminal. Currently supported is the PID of the foreground process and the name of the slave PTY. If there is an error retrieving the information, or the platform does not support retieving that information `null` is returned. This will be useful in exposing the foreground PID and slave PTY name to AppleScript or other APIs.
This commit is contained in:
@@ -135,6 +135,35 @@ pub fn add(
|
||||
// Every exe needs the terminal options
|
||||
self.config.terminalOptions().add(b, step.root_module);
|
||||
|
||||
// C imports needed to manage/create PTYs
|
||||
switch (target.result.os.tag) {
|
||||
.freebsd => {
|
||||
const c = b.addTranslateC(.{
|
||||
.root_source_file = b.path("src/pty/freebsd.c"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
step.root_module.addImport("pty-c", c.createModule());
|
||||
},
|
||||
.linux => {
|
||||
const c = b.addTranslateC(.{
|
||||
.root_source_file = b.path("src/pty/linux.c"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
step.root_module.addImport("pty-c", c.createModule());
|
||||
},
|
||||
.macos => {
|
||||
const c = b.addTranslateC(.{
|
||||
.root_source_file = b.path("src/pty/macos.c"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
step.root_module.addImport("pty-c", c.createModule());
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
|
||||
// Freetype. We always include this even if our font backend doesn't
|
||||
// use it because Dear Imgui uses Freetype.
|
||||
_ = b.systemIntegrationOption("freetype", .{}); // Shows it in help
|
||||
|
||||
Reference in New Issue
Block a user