mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
Merge pull request #541 from rockorager/dev
config: add term config option
This commit is contained in:
@ -411,6 +411,9 @@ keybind: Keybinds = .{},
|
|||||||
/// Debug builds of Ghostty have a separate single-instance ID.
|
/// Debug builds of Ghostty have a separate single-instance ID.
|
||||||
@"gtk-single-instance": bool = true,
|
@"gtk-single-instance": bool = true,
|
||||||
|
|
||||||
|
/// This will be used to set the TERM environment variable
|
||||||
|
term: []const u8 = "ghostty",
|
||||||
|
|
||||||
/// This is set by the CLI parser for deinit.
|
/// This is set by the CLI parser for deinit.
|
||||||
_arena: ?ArenaAllocator = null,
|
_arena: ?ArenaAllocator = null,
|
||||||
|
|
||||||
@ -899,6 +902,11 @@ pub fn finalize(self: *Config) !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prevent setting TERM to an empty string
|
||||||
|
if (self.term.len == 0) {
|
||||||
|
self.term = "ghostty";
|
||||||
|
}
|
||||||
|
|
||||||
// The default for the working directory depends on the system.
|
// The default for the working directory depends on the system.
|
||||||
const wd = self.@"working-directory" orelse switch (builtin.os.tag) {
|
const wd = self.@"working-directory" orelse switch (builtin.os.tag) {
|
||||||
.macos => if (c.getppid() == 1) "home" else "inherit",
|
.macos => if (c.getppid() == 1) "home" else "inherit",
|
||||||
|
@ -98,6 +98,12 @@ pub const ghostty: Source = .{
|
|||||||
// Colored underlines
|
// Colored underlines
|
||||||
.{ .name = "Setulc", .value = .{ .string = "\\E[58:2::%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%d%;m" } },
|
.{ .name = "Setulc", .value = .{ .string = "\\E[58:2::%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%d%;m" } },
|
||||||
|
|
||||||
|
// Cursor styles
|
||||||
|
.{ .name = "Ss", .value = .{ .string = "\\E[%p1%d q" } },
|
||||||
|
|
||||||
|
// Cursor style reset
|
||||||
|
.{ .name = "Se", .value = .{ .string = "\\E[2 q" } },
|
||||||
|
|
||||||
// These are all capabilities that should be pretty straightforward
|
// These are all capabilities that should be pretty straightforward
|
||||||
// and map to input sequences.
|
// and map to input sequences.
|
||||||
.{ .name = "bel", .value = .{ .string = "^G" } },
|
.{ .name = "bel", .value = .{ .string = "^G" } },
|
||||||
|
@ -91,6 +91,7 @@ pub const DerivedConfig = struct {
|
|||||||
foreground: configpkg.Config.Color,
|
foreground: configpkg.Config.Color,
|
||||||
background: configpkg.Config.Color,
|
background: configpkg.Config.Color,
|
||||||
osc_color_report_format: configpkg.Config.OSCColorReportFormat,
|
osc_color_report_format: configpkg.Config.OSCColorReportFormat,
|
||||||
|
term: []const u8,
|
||||||
|
|
||||||
pub fn init(
|
pub fn init(
|
||||||
alloc_gpa: Allocator,
|
alloc_gpa: Allocator,
|
||||||
@ -106,6 +107,7 @@ pub const DerivedConfig = struct {
|
|||||||
.foreground = config.foreground,
|
.foreground = config.foreground,
|
||||||
.background = config.background,
|
.background = config.background,
|
||||||
.osc_color_report_format = config.@"osc-color-report-format",
|
.osc_color_report_format = config.@"osc-color-report-format",
|
||||||
|
.term = config.term,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -663,7 +665,7 @@ const Subprocess = struct {
|
|||||||
if (opts.resources_dir) |base| {
|
if (opts.resources_dir) |base| {
|
||||||
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||||
const dir = try std.fmt.bufPrint(&buf, "{s}/terminfo", .{base});
|
const dir = try std.fmt.bufPrint(&buf, "{s}/terminfo", .{base});
|
||||||
try env.put("TERM", "xterm-ghostty");
|
try env.put("TERM", opts.config.term);
|
||||||
try env.put("COLORTERM", "truecolor");
|
try env.put("COLORTERM", "truecolor");
|
||||||
try env.put("TERMINFO", dir);
|
try env.put("TERMINFO", dir);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user