diff options
Diffstat (limited to 'vendor/libghostty-vt/src/apprt/embedded.zig')
| -rw-r--r-- | vendor/libghostty-vt/src/apprt/embedded.zig | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/vendor/libghostty-vt/src/apprt/embedded.zig b/vendor/libghostty-vt/src/apprt/embedded.zig index 519a35f2..730913eb 100644 --- a/vendor/libghostty-vt/src/apprt/embedded.zig +++ b/vendor/libghostty-vt/src/apprt/embedded.zig @@ -20,6 +20,7 @@ const CoreInspector = @import("../inspector/main.zig").Inspector; const CoreSurface = @import("../Surface.zig"); const configpkg = @import("../config.zig"); const Config = configpkg.Config; +const String = @import("../main_c.zig").String; const log = std.log.scoped(.embedded_window); @@ -1465,8 +1466,8 @@ pub const CAPI = struct { /// if it were sent to the surface right now. The "right now" /// is important because things like trigger sequences are only /// valid until the next key event. - export fn ghostty_app_key_is_binding( - app: *App, + export fn ghostty_config_key_is_binding( + config: *Config, event: KeyEvent, ) bool { const core_event = event.keyEvent().core() orelse { @@ -1474,7 +1475,7 @@ pub const CAPI = struct { return false; }; - return app.core_app.keyEventIsBinding(app, core_event); + return config.keyEventIsBinding(core_event); } /// Notify the app that the keyboard was changed. This causes the @@ -1709,6 +1710,23 @@ pub const CAPI = struct { }; } + /// Returns the PID of the foreground process for the surface PTY. + export fn ghostty_surface_foreground_pid(surface: *Surface) u64 { + return surface.core_surface.getProcessInfo(.foreground_pid) orelse 0; + } + + /// Returns the PTY name for the surface. The returned string must be + /// freed by the caller via ghostty_string_free. + export fn ghostty_surface_tty_name(surface: *Surface) String { + const tty_name = surface.core_surface.getProcessInfo(.tty_name) orelse return .empty; + const copy = surface.app.core_app.alloc.dupeZ(u8, tty_name) catch |err| { + log.err("error allocating tty name err={}", .{err}); + return .empty; + }; + + return .fromSlice(copy); + } + /// Update the color scheme of the surface. export fn ghostty_surface_set_color_scheme(surface: *Surface, scheme_raw: c_int) void { const scheme = std.meta.intToEnum(apprt.ColorScheme, scheme_raw) catch { |
