mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
apprt/glfw: inherit working dir
This commit is contained in:
@ -346,10 +346,25 @@ pub const Surface = struct {
|
||||
try app.app.addSurface(self);
|
||||
errdefer app.app.deleteSurface(self);
|
||||
|
||||
// Our parent pwd will be tracked here
|
||||
const alloc = app.app.alloc;
|
||||
var parent_pwd: ?[]const u8 = null;
|
||||
defer if (parent_pwd) |v| alloc.free(v);
|
||||
|
||||
// Shallow copy the config so that we can modify it.
|
||||
var config = app.config;
|
||||
|
||||
// Get our previously focused surface
|
||||
const parent = app.app.focusedSurface();
|
||||
if (parent) |p| {
|
||||
parent_pwd = try p.pwd(alloc);
|
||||
if (parent_pwd) |v| config.@"working-directory" = v;
|
||||
}
|
||||
|
||||
// Initialize our surface now that we have the stable pointer.
|
||||
try self.core_surface.init(
|
||||
app.app.alloc,
|
||||
&app.config,
|
||||
alloc,
|
||||
&config,
|
||||
.{ .rt_app = app, .mailbox = &app.app.mailbox },
|
||||
self,
|
||||
);
|
||||
|
Reference in New Issue
Block a user