mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 05:50:27 +00:00
gtk: remove modifications to the core for overrides
This commit is contained in:
@@ -463,12 +463,6 @@ pub fn init(
|
||||
app: *App,
|
||||
rt_app: *apprt.runtime.App,
|
||||
rt_surface: *apprt.runtime.Surface,
|
||||
overrides: struct {
|
||||
command: ?configpkg.Command = null,
|
||||
working_directory: ?[:0]const u8 = null,
|
||||
|
||||
pub const none: @This() = .{};
|
||||
},
|
||||
) !void {
|
||||
// Apply our conditional state. If we fail to apply the conditional state
|
||||
// then we log and attempt to move forward with the old config.
|
||||
@@ -614,9 +608,6 @@ pub fn init(
|
||||
|
||||
// The command we're going to execute
|
||||
const command: ?configpkg.Command = command: {
|
||||
if (overrides.command) |command| {
|
||||
break :command command;
|
||||
}
|
||||
if (app.first) {
|
||||
if (config.@"initial-command") |command| {
|
||||
break :command command;
|
||||
@@ -625,14 +616,6 @@ pub fn init(
|
||||
break :command config.command;
|
||||
};
|
||||
|
||||
// The working directory to execute the command in.
|
||||
const working_directory: ?[]const u8 = wd: {
|
||||
if (overrides.working_directory) |working_directory| {
|
||||
break :wd working_directory;
|
||||
}
|
||||
break :wd config.@"working-directory";
|
||||
};
|
||||
|
||||
// Start our IO implementation
|
||||
// This separate block ({}) is important because our errdefers must
|
||||
// be scoped here to be valid.
|
||||
@@ -656,7 +639,7 @@ pub fn init(
|
||||
.shell_integration = config.@"shell-integration",
|
||||
.shell_integration_features = config.@"shell-integration-features",
|
||||
.cursor_blink = config.@"cursor-style-blink",
|
||||
.working_directory = working_directory,
|
||||
.working_directory = config.@"working-directory",
|
||||
.resources_dir = global_state.resources_dir.host(),
|
||||
.term = config.term,
|
||||
.rt_pre_exec_info = .init(config),
|
||||
|
||||
@@ -572,7 +572,6 @@ pub const Surface = struct {
|
||||
app.core_app,
|
||||
app,
|
||||
self,
|
||||
.none,
|
||||
);
|
||||
errdefer self.core_surface.deinit();
|
||||
|
||||
|
||||
@@ -3343,7 +3343,7 @@ pub const Surface = extern struct {
|
||||
};
|
||||
|
||||
fn initSurface(self: *Self) InitError!void {
|
||||
const priv = self.private();
|
||||
const priv: *Private = self.private();
|
||||
assert(priv.core_surface == null);
|
||||
const gl_area = priv.gl_area;
|
||||
|
||||
@@ -3376,6 +3376,13 @@ pub const Surface = extern struct {
|
||||
);
|
||||
defer config.deinit();
|
||||
|
||||
if (priv.overrides.command) |c| {
|
||||
config.command = try c.clone(config._arena.?.allocator());
|
||||
}
|
||||
if (priv.overrides.working_directory) |wd| {
|
||||
config.@"working-directory" = try config._arena.?.allocator().dupeZ(u8, wd);
|
||||
}
|
||||
|
||||
// Properties that can impact surface init
|
||||
if (priv.font_size_request) |size| config.@"font-size" = size.points;
|
||||
if (priv.pwd) |pwd| config.@"working-directory" = pwd;
|
||||
@@ -3387,10 +3394,6 @@ pub const Surface = extern struct {
|
||||
app.core(),
|
||||
app.rt(),
|
||||
&priv.rt_surface,
|
||||
.{
|
||||
.command = priv.overrides.command,
|
||||
.working_directory = priv.overrides.working_directory,
|
||||
},
|
||||
) catch |err| {
|
||||
log.warn("failed to initialize surface err={}", .{err});
|
||||
return error.SurfaceError;
|
||||
|
||||
Reference in New Issue
Block a user