mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-24 20:56:08 +03:00

Instead of using @hasDecl, use a performAction-stype API. The C interface for interfacing with macOS (or any other apprt where Ghostty is embedded) is unfinished.
27 lines
732 B
Zig
27 lines
732 B
Zig
//! Functions for inter-process communication.
|
|
const IPC = @This();
|
|
|
|
const std = @import("std");
|
|
const Allocator = std.mem.Allocator;
|
|
|
|
const apprt = @import("../../apprt.zig");
|
|
|
|
pub const openNewWindow = @import("ipc/new_window.zig").openNewWindow;
|
|
|
|
/// Send the given IPC to a running Ghostty. Returns `true` if the action was
|
|
/// able to be performed, `false` otherwise.
|
|
pub fn sendIPC(
|
|
alloc: Allocator,
|
|
target: apprt.ipc.Target,
|
|
comptime action: apprt.ipc.Action.Key,
|
|
value: apprt.ipc.Action.Value(action),
|
|
) (Allocator.Error || std.posix.WriteError || apprt.ipc.Errors)!bool {
|
|
switch (action) {
|
|
.new_window => return try openNewWindow(alloc, target, value),
|
|
}
|
|
}
|
|
|
|
test {
|
|
_ = openNewWindow;
|
|
}
|