mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03: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
|
||||
// CLO_ON_EXEC for this fd.
|
||||
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) {
|
||||
const result: bool = switch (config.@"async-backend") {
|
||||
.auto => unreachable,
|
||||
.epoll => xev.prefer(.epoll),
|
||||
.io_uring => xev.prefer(.io_uring),
|
||||
.epoll => if (comptime xev.dynamic) xev.prefer(.epoll) else false,
|
||||
.io_uring => if (comptime xev.dynamic) xev.prefer(.io_uring) else false,
|
||||
};
|
||||
|
||||
if (result) {
|
||||
|
@ -2817,7 +2817,7 @@ pub fn loadCliArgs(self: *Config, alloc_gpa: Allocator) !void {
|
||||
.windows => {},
|
||||
|
||||
// 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
|
||||
// not use std.os.argv.
|
||||
@ -2835,7 +2835,7 @@ pub fn loadCliArgs(self: *Config, alloc_gpa: Allocator) !void {
|
||||
// styling, etc. based on the command.
|
||||
//
|
||||
// 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| {
|
||||
const arena_alloc = self._arena.?.allocator();
|
||||
|
||||
|
@ -11,7 +11,7 @@ pub const entries: []const Entry = entries: {
|
||||
const native_idx = switch (builtin.os.tag) {
|
||||
.ios, .macos => 4, // mac
|
||||
.windows => 3, // win
|
||||
.linux => 2, // xkb
|
||||
.freebsd, .linux => 2, // xkb
|
||||
else => @compileError("unsupported platform"),
|
||||
};
|
||||
|
||||
|
@ -56,6 +56,9 @@ pub fn launchedFromDesktop() bool {
|
||||
// iPhone/iPad is always launched from the "desktop"
|
||||
.ios => true,
|
||||
|
||||
// Assume we are launching from the "desktop"
|
||||
.freebsd => true,
|
||||
|
||||
else => @compileError("unsupported platform"),
|
||||
};
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ const Error = error{
|
||||
/// is generally an expensive process so the value should be cached.
|
||||
pub inline fn home(buf: []u8) !?[]const u8 {
|
||||
return switch (builtin.os.tag) {
|
||||
inline .linux, .macos => try homeUnix(buf),
|
||||
inline .linux, .freebsd, .macos => try homeUnix(buf),
|
||||
.windows => try homeWindows(buf),
|
||||
|
||||
// iOS doesn't have a user-writable home directory
|
||||
@ -122,7 +122,7 @@ pub const ExpandError = error{
|
||||
/// than `buf.len`.
|
||||
pub fn expandHome(path: []const u8, buf: []u8) ExpandError![]const u8 {
|
||||
return switch (builtin.os.tag) {
|
||||
.linux, .macos => try expandHomeUnix(path, buf),
|
||||
.linux, .freebsd, .macos => try expandHomeUnix(path, buf),
|
||||
.ios => return path,
|
||||
else => @compileError("unimplemented"),
|
||||
};
|
||||
|
@ -69,22 +69,24 @@ pub const InitError = error{
|
||||
/// used by libghostty.
|
||||
pub fn init(resources_dir: []const u8) InitError!void {
|
||||
// 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
|
||||
// is standard for translations.
|
||||
const share_dir = std.fs.path.dirname(resources_dir) orelse
|
||||
return error.InvalidResourcesDir;
|
||||
|
||||
// Our resources dir is always nested below the share dir that
|
||||
// is standard for translations.
|
||||
const share_dir = std.fs.path.dirname(resources_dir) orelse
|
||||
return error.InvalidResourcesDir;
|
||||
// Build our locale path
|
||||
var buf: [std.fs.max_path_bytes]u8 = undefined;
|
||||
const path = std.fmt.bufPrintZ(&buf, "{s}/locale", .{share_dir}) catch
|
||||
return error.OutOfMemory;
|
||||
|
||||
// Build our locale path
|
||||
var buf: [std.fs.max_path_bytes]u8 = undefined;
|
||||
const path = std.fmt.bufPrintZ(&buf, "{s}/locale", .{share_dir}) catch
|
||||
return error.OutOfMemory;
|
||||
|
||||
// Bind our bundle ID to the given locale path
|
||||
log.debug("binding domain={s} path={s}", .{ build_config.bundle_id, path });
|
||||
_ = bindtextdomain(build_config.bundle_id, path.ptr) orelse
|
||||
return error.OutOfMemory;
|
||||
// Bind our bundle ID to the given locale path
|
||||
log.debug("binding domain={s} path={s}", .{ build_config.bundle_id, path });
|
||||
_ = bindtextdomain(build_config.bundle_id, path.ptr) orelse
|
||||
return error.OutOfMemory;
|
||||
}}
|
||||
}
|
||||
|
||||
/// Set the global gettext domain to our bundle ID, allowing unqualified
|
||||
|
@ -19,7 +19,7 @@ pub fn open(
|
||||
url: []const u8,
|
||||
) !void {
|
||||
const cmd: OpenCommand = switch (builtin.os.tag) {
|
||||
.linux => .{ .child = std.process.Child.init(
|
||||
.linux, .freebsd => .{ .child = std.process.Child.init(
|
||||
&.{ "xdg-open", url },
|
||||
alloc,
|
||||
) },
|
||||
|
@ -99,6 +99,10 @@ const PosixPty = struct {
|
||||
@cInclude("sys/ioctl.h"); // ioctl and constants
|
||||
@cInclude("util.h"); // openpty()
|
||||
}),
|
||||
.freebsd => @cImport({
|
||||
@cInclude("termios.h"); // ioctl and constants
|
||||
@cInclude("libutil.h"); // openpty()
|
||||
}),
|
||||
else => @cImport({
|
||||
@cInclude("sys/ioctl.h"); // ioctl and constants
|
||||
@cInclude("pty.h");
|
||||
|
Reference in New Issue
Block a user