ghostty/src/apprt/gtk/IPC.zig
Jeffrey C. Ollie 81358c8dca cli/gtk: replace @hasDecl for performAction-style API
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.
2025-07-14 14:48:11 -05:00

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;
}