mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-02 16:08:39 +00:00
@@ -323,7 +323,7 @@ fn setupFd(src: File.Handle, target: i32) !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.ios, .macos => {
|
.freebsd, .ios, .macos => {
|
||||||
// Mac doesn't support dup3 so we use dup2. We purposely clear
|
// Mac doesn't support dup3 so we use dup2. We purposely clear
|
||||||
// CLO_ON_EXEC for this fd.
|
// CLO_ON_EXEC for this fd.
|
||||||
const flags = try posix.fcntl(src, posix.F.GETFD, 0);
|
const flags = try posix.fcntl(src, posix.F.GETFD, 0);
|
||||||
|
@@ -143,8 +143,8 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
|
|||||||
if (config.@"async-backend" != .auto) {
|
if (config.@"async-backend" != .auto) {
|
||||||
const result: bool = switch (config.@"async-backend") {
|
const result: bool = switch (config.@"async-backend") {
|
||||||
.auto => unreachable,
|
.auto => unreachable,
|
||||||
.epoll => xev.prefer(.epoll),
|
.epoll => if (comptime xev.dynamic) xev.prefer(.epoll) else false,
|
||||||
.io_uring => xev.prefer(.io_uring),
|
.io_uring => if (comptime xev.dynamic) xev.prefer(.io_uring) else false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@@ -2817,7 +2817,7 @@ pub fn loadCliArgs(self: *Config, alloc_gpa: Allocator) !void {
|
|||||||
.windows => {},
|
.windows => {},
|
||||||
|
|
||||||
// Fast-path if we are Linux and have no args.
|
// Fast-path if we are Linux and have no args.
|
||||||
.linux => if (std.os.argv.len <= 1) return,
|
.linux, .freebsd => if (std.os.argv.len <= 1) return,
|
||||||
|
|
||||||
// Everything else we have to at least try because it may
|
// Everything else we have to at least try because it may
|
||||||
// not use std.os.argv.
|
// not use std.os.argv.
|
||||||
@@ -2835,7 +2835,7 @@ pub fn loadCliArgs(self: *Config, alloc_gpa: Allocator) !void {
|
|||||||
// styling, etc. based on the command.
|
// styling, etc. based on the command.
|
||||||
//
|
//
|
||||||
// See: https://github.com/Vladimir-csp/xdg-terminal-exec
|
// See: https://github.com/Vladimir-csp/xdg-terminal-exec
|
||||||
if (comptime builtin.os.tag == .linux) {
|
if ((comptime builtin.os.tag == .linux) or (comptime builtin.os.tag == .freebsd)) {
|
||||||
if (internal_os.xdg.parseTerminalExec(std.os.argv)) |args| {
|
if (internal_os.xdg.parseTerminalExec(std.os.argv)) |args| {
|
||||||
const arena_alloc = self._arena.?.allocator();
|
const arena_alloc = self._arena.?.allocator();
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@ pub const entries: []const Entry = entries: {
|
|||||||
const native_idx = switch (builtin.os.tag) {
|
const native_idx = switch (builtin.os.tag) {
|
||||||
.ios, .macos => 4, // mac
|
.ios, .macos => 4, // mac
|
||||||
.windows => 3, // win
|
.windows => 3, // win
|
||||||
.linux => 2, // xkb
|
.freebsd, .linux => 2, // xkb
|
||||||
else => @compileError("unsupported platform"),
|
else => @compileError("unsupported platform"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -56,6 +56,9 @@ pub fn launchedFromDesktop() bool {
|
|||||||
// iPhone/iPad is always launched from the "desktop"
|
// iPhone/iPad is always launched from the "desktop"
|
||||||
.ios => true,
|
.ios => true,
|
||||||
|
|
||||||
|
// Assume we are launching from the "desktop"
|
||||||
|
.freebsd => true,
|
||||||
|
|
||||||
else => @compileError("unsupported platform"),
|
else => @compileError("unsupported platform"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ const Error = error{
|
|||||||
/// is generally an expensive process so the value should be cached.
|
/// is generally an expensive process so the value should be cached.
|
||||||
pub inline fn home(buf: []u8) !?[]const u8 {
|
pub inline fn home(buf: []u8) !?[]const u8 {
|
||||||
return switch (builtin.os.tag) {
|
return switch (builtin.os.tag) {
|
||||||
inline .linux, .macos => try homeUnix(buf),
|
inline .linux, .freebsd, .macos => try homeUnix(buf),
|
||||||
.windows => try homeWindows(buf),
|
.windows => try homeWindows(buf),
|
||||||
|
|
||||||
// iOS doesn't have a user-writable home directory
|
// iOS doesn't have a user-writable home directory
|
||||||
@@ -122,7 +122,7 @@ pub const ExpandError = error{
|
|||||||
/// than `buf.len`.
|
/// than `buf.len`.
|
||||||
pub fn expandHome(path: []const u8, buf: []u8) ExpandError![]const u8 {
|
pub fn expandHome(path: []const u8, buf: []u8) ExpandError![]const u8 {
|
||||||
return switch (builtin.os.tag) {
|
return switch (builtin.os.tag) {
|
||||||
.linux, .macos => try expandHomeUnix(path, buf),
|
.linux, .freebsd, .macos => try expandHomeUnix(path, buf),
|
||||||
.ios => return path,
|
.ios => return path,
|
||||||
else => @compileError("unimplemented"),
|
else => @compileError("unimplemented"),
|
||||||
};
|
};
|
||||||
|
@@ -69,8 +69,9 @@ pub const InitError = error{
|
|||||||
/// used by libghostty.
|
/// used by libghostty.
|
||||||
pub fn init(resources_dir: []const u8) InitError!void {
|
pub fn init(resources_dir: []const u8) InitError!void {
|
||||||
// i18n is unsupported on Windows
|
// i18n is unsupported on Windows
|
||||||
if (builtin.os.tag == .windows) return;
|
switch (builtin.os.tag) {
|
||||||
|
.windows, .freebsd => return,
|
||||||
|
else => {
|
||||||
// Our resources dir is always nested below the share dir that
|
// Our resources dir is always nested below the share dir that
|
||||||
// is standard for translations.
|
// is standard for translations.
|
||||||
const share_dir = std.fs.path.dirname(resources_dir) orelse
|
const share_dir = std.fs.path.dirname(resources_dir) orelse
|
||||||
@@ -85,6 +86,7 @@ pub fn init(resources_dir: []const u8) InitError!void {
|
|||||||
log.debug("binding domain={s} path={s}", .{ build_config.bundle_id, path });
|
log.debug("binding domain={s} path={s}", .{ build_config.bundle_id, path });
|
||||||
_ = bindtextdomain(build_config.bundle_id, path.ptr) orelse
|
_ = bindtextdomain(build_config.bundle_id, path.ptr) orelse
|
||||||
return error.OutOfMemory;
|
return error.OutOfMemory;
|
||||||
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the global gettext domain to our bundle ID, allowing unqualified
|
/// Set the global gettext domain to our bundle ID, allowing unqualified
|
||||||
|
@@ -19,7 +19,7 @@ pub fn open(
|
|||||||
url: []const u8,
|
url: []const u8,
|
||||||
) !void {
|
) !void {
|
||||||
const cmd: OpenCommand = switch (builtin.os.tag) {
|
const cmd: OpenCommand = switch (builtin.os.tag) {
|
||||||
.linux => .{ .child = std.process.Child.init(
|
.linux, .freebsd => .{ .child = std.process.Child.init(
|
||||||
&.{ "xdg-open", url },
|
&.{ "xdg-open", url },
|
||||||
alloc,
|
alloc,
|
||||||
) },
|
) },
|
||||||
|
@@ -99,6 +99,10 @@ const PosixPty = struct {
|
|||||||
@cInclude("sys/ioctl.h"); // ioctl and constants
|
@cInclude("sys/ioctl.h"); // ioctl and constants
|
||||||
@cInclude("util.h"); // openpty()
|
@cInclude("util.h"); // openpty()
|
||||||
}),
|
}),
|
||||||
|
.freebsd => @cImport({
|
||||||
|
@cInclude("termios.h"); // ioctl and constants
|
||||||
|
@cInclude("libutil.h"); // openpty()
|
||||||
|
}),
|
||||||
else => @cImport({
|
else => @cImport({
|
||||||
@cInclude("sys/ioctl.h"); // ioctl and constants
|
@cInclude("sys/ioctl.h"); // ioctl and constants
|
||||||
@cInclude("pty.h");
|
@cInclude("pty.h");
|
||||||
|
Reference in New Issue
Block a user