mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-05 19:08:17 +00:00
apprt/gtk-ng: winproto callbacks for subprocess env
This commit is contained in:
@@ -26,6 +26,7 @@ const Config = @import("config.zig").Config;
|
||||
const ResizeOverlay = @import("resize_overlay.zig").ResizeOverlay;
|
||||
const ChildExited = @import("surface_child_exited.zig").SurfaceChildExited;
|
||||
const ClipboardConfirmationDialog = @import("clipboard_confirmation_dialog.zig").ClipboardConfirmationDialog;
|
||||
const Window = @import("window.zig").Window;
|
||||
|
||||
const log = std.log.scoped(.gtk_ghostty_surface);
|
||||
|
||||
@@ -1061,8 +1062,6 @@ pub const Surface = extern struct {
|
||||
}
|
||||
|
||||
pub fn defaultTermioEnv(self: *Self) !std.process.EnvMap {
|
||||
_ = self;
|
||||
|
||||
const alloc = Application.default().allocator();
|
||||
var env = try internal_os.getEnvMap(alloc);
|
||||
errdefer env.deinit();
|
||||
@@ -1099,6 +1098,14 @@ pub const Surface = extern struct {
|
||||
env.remove("GTK_PATH");
|
||||
}
|
||||
|
||||
// This is a hack because it ties ourselves (optionally) to the
|
||||
// Window class. The right solution we should do is emit a signal
|
||||
// here where the handler can modify our EnvMap, but boxing the
|
||||
// EnvMap is a bit annoying so I'm punting it.
|
||||
if (ext.getAncestor(Window, self.as(gtk.Widget))) |window| {
|
||||
try window.winproto().addSubprocessEnv(&env);
|
||||
}
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
|
@@ -363,6 +363,11 @@ pub const Window = extern struct {
|
||||
}
|
||||
}
|
||||
|
||||
/// Winproto backend for this window.
|
||||
pub fn winproto(self: *Self) *winprotopkg.Window {
|
||||
return &self.private().winproto;
|
||||
}
|
||||
|
||||
/// Create a new tab with the given parent. The tab will be inserted
|
||||
/// at the position dictated by the `window-new-tab-position` config.
|
||||
/// The new tab will be selected.
|
||||
|
Reference in New Issue
Block a user