Compare commits

...

2 commits

Author SHA1 Message Date
LordMZTE 76d2c2887a
port to latest Zig
mostly pointless but gigantic stdlib refactor, typical.
2024-03-23 16:58:27 +01:00
LordMZTE c5dc5dd1e9
mzte-nv: add nvim-nio
dap-ui now depends on it
2024-03-23 16:20:18 +01:00
27 changed files with 85 additions and 72 deletions

View file

@ -16,7 +16,7 @@ pub fn logFn(
null; null;
const color = log_file == null and stderr_isatty orelse blk: { const color = log_file == null and stderr_isatty orelse blk: {
const isatty = std.os.isatty(std.os.STDERR_FILENO); const isatty = std.posix.isatty(std.posix.STDERR_FILENO);
stderr_isatty = isatty; stderr_isatty = isatty;
break :blk isatty; break :blk isatty;
}; };

View file

@ -48,6 +48,8 @@ pub fn build(b: *std.Build) !void {
compiler.linkLibC(); compiler.linkLibC();
compiler.linkSystemLibrary("luajit"); compiler.linkSystemLibrary("luajit");
compiler.root_module.addImport("common", b.dependency("common", .{}).module("common"));
compiler.root_module.unwind_tables = true; compiler.root_module.unwind_tables = true;
b.installArtifact(compiler); b.installArtifact(compiler);

View file

@ -65,6 +65,7 @@
(use/mztegit :promise-async) (use/mztegit :promise-async)
(use/pconf :nvim-ufo :ufo {:after :nvim-lspconfig}) (use/pconf :nvim-ufo :ufo {:after :nvim-lspconfig})
(use/pconf :aerial.nvim :aerial) (use/pconf :aerial.nvim :aerial)
(use/mztegit :nvim-nio) ;; dep of dap-ui
(use/mztegit :nvim-dap-ui) (use/mztegit :nvim-dap-ui)
(use/pconf :nvim-dap :dap) (use/pconf :nvim-dap :dap)
(use/pconf :harpoon :harpoon) (use/pconf :harpoon :harpoon)

View file

@ -7,6 +7,7 @@ const log = std.log.scoped(.compiler);
pub const std_options = std.Options{ pub const std_options = std.Options{
.log_level = .debug, .log_level = .debug,
.logFn = @import("common").logFn,
}; };
pub fn main() !void { pub fn main() !void {

View file

@ -74,7 +74,7 @@ fn lFindRuntimes(l: *c.lua_State) !c_int {
/// https://github.com/dgileadi/vscode-java-decompiler/tree/master/server /// https://github.com/dgileadi/vscode-java-decompiler/tree/master/server
// TODO: add command to download these maybe? // TODO: add command to download these maybe?
fn lGetBundleInfo(l: *c.lua_State) !c_int { fn lGetBundleInfo(l: *c.lua_State) !c_int {
const home = std.os.getenv("HOME") orelse return error.HomeNotSet; const home = std.posix.getenv("HOME") orelse return error.HomeNotSet;
const bundle_path = try std.fs.path.join( const bundle_path = try std.fs.path.join(
std.heap.c_allocator, std.heap.c_allocator,
@ -137,10 +137,10 @@ fn lGetBundleInfo(l: *c.lua_State) !c_int {
} }
fn lGetDirs(l: *c.lua_State) !c_int { fn lGetDirs(l: *c.lua_State) !c_int {
const home = std.os.getenv("HOME") orelse return error.HomeNotSet; const home = std.posix.getenv("HOME") orelse return error.HomeNotSet;
var cwd_buf: [256]u8 = undefined; var cwd_buf: [256]u8 = undefined;
const cwd_basename = std.fs.path.basename(try std.os.getcwd(&cwd_buf)); const cwd_basename = std.fs.path.basename(try std.posix.getcwd(&cwd_buf));
const config_path = try std.fs.path.joinZ( const config_path = try std.fs.path.joinZ(
std.heap.c_allocator, std.heap.c_allocator,

View file

@ -14,7 +14,7 @@ pub fn luaPush(l: *c.lua_State) void {
/// This is basically a reimplementation of `which`. /// This is basically a reimplementation of `which`.
fn lFindInPath(l: *c.lua_State) !c_int { fn lFindInPath(l: *c.lua_State) !c_int {
const bin = ffi.luaCheckstring(l, 1); const bin = ffi.luaCheckstring(l, 1);
const path = std.os.getenv("PATH") orelse return error.PathNotSet; const path = std.posix.getenv("PATH") orelse return error.PathNotSet;
var splits = std.mem.split(u8, path, ":"); var splits = std.mem.split(u8, path, ":");
while (splits.next()) |p| { while (splits.next()) |p| {

View file

@ -7,6 +7,8 @@ const c = ffi.c;
const ffi = @import("../ffi.zig"); const ffi = @import("../ffi.zig");
const util = @import("../util.zig"); const util = @import("../util.zig");
const log = std.log.scoped(.@"live-chat");
// Zig segfaults when this is a ZST // Zig segfaults when this is a ZST
padding: u1 = 0, padding: u1 = 0,
@ -33,9 +35,9 @@ pub fn onEvent(self: *LiveChat, mpv: *c.mpv_handle, ev: *c.mpv_event) !void {
else => return e, else => return e,
}; };
errdefer file.close(); errdefer file.close();
std.log.info("initializing subtitle transcoder: {s}", .{fname}); log.info("initializing subtitle transcoder: {s}", .{fname});
const pipe = try std.os.pipe2(.{}); const pipe = try std.posix.pipe2(.{});
// This needs to be done here instead of the separate thread. MPV will instantly // This needs to be done here instead of the separate thread. MPV will instantly
// give up if there's nothing to be read from the pipe when the command is called. // give up if there's nothing to be read from the pipe when the command is called.
@ -85,7 +87,7 @@ fn transcoderThread(jsonf: std.fs.File, pipefd: std.c.fd_t) !void {
else => return e, else => return e,
}; };
processLine(line_buf.items, pipe.writer()) catch |e| { processLine(line_buf.items, pipe.writer()) catch |e| {
std.log.warn("failed to parse chat entry: {}", .{e}); log.warn("failed to parse chat entry: {}", .{e});
}; };
} }

View file

@ -4,6 +4,8 @@ const c = ffi.c;
const ffi = @import("../ffi.zig"); const ffi = @import("../ffi.zig");
const util = @import("../util.zig"); const util = @import("../util.zig");
const log = std.log.scoped(.@"sb-skip");
const ChapterSet = std.AutoHashMap(isize, void); const ChapterSet = std.AutoHashMap(isize, void);
skipped_chapters: ChapterSet, skipped_chapters: ChapterSet,
@ -84,7 +86,7 @@ fn onChapterChange(
@constCast(&end_time), @constCast(&end_time),
)); ));
try self.skipped_chapters.put(chapter_id, {}); try self.skipped_chapters.put(chapter_id, {});
try util.msg(mpv, "skipped: {s}", .{reason}); try util.msg(mpv, .@"sb-skip", "skipped: {s}", .{reason});
} }
} }

View file

@ -3,11 +3,16 @@ const c = ffi.c;
const ffi = @import("ffi.zig"); const ffi = @import("ffi.zig");
pub fn msg(mpv: *c.mpv_handle, comptime fmt: []const u8, args: anytype) !void { pub fn msg(
std.log.info(fmt, args); mpv: *c.mpv_handle,
scope: @TypeOf(.enum_tag),
comptime fmt: []const u8,
args: anytype,
) !void {
std.log.scoped(scope).info(fmt, args);
var buf: [1024 * 4]u8 = undefined; var buf: [1024 * 4]u8 = undefined;
const osd_msg = try std.fmt.bufPrintZ(&buf, "[sbskip] " ++ fmt, args); const osd_msg = try std.fmt.bufPrintZ(&buf, "[mzte-mpv " ++ @tagName(scope) ++ "] " ++ fmt, args);
try ffi.checkMpvError(c.mpv_command( try ffi.checkMpvError(c.mpv_command(
mpv, mpv,
@constCast(&[_:null]?[*:0]const u8{ "show-text", osd_msg, "4000" }), @constCast(&[_:null]?[*:0]const u8{ "show-text", osd_msg, "4000" }),

View file

@ -2,7 +2,7 @@ const std = @import("std");
pub fn commandsCachePath(alloc: std.mem.Allocator) ![]const u8 { pub fn commandsCachePath(alloc: std.mem.Allocator) ![]const u8 {
return try std.fs.path.join(alloc, &.{ return try std.fs.path.join(alloc, &.{
std.os.getenv("HOME") orelse return error.HomeNotSet, std.posix.getenv("HOME") orelse return error.HomeNotSet,
".cache", ".cache",
"alecor", "alecor",
"commands", "commands",
@ -20,26 +20,26 @@ pub fn generate(alloc: std.mem.Allocator) !void {
var cache_file = try std.fs.cwd().createFile(cache_path, .{}); var cache_file = try std.fs.cwd().createFile(cache_path, .{});
defer cache_file.close(); defer cache_file.close();
const pipefds = try std.os.pipe(); const pipefds = try std.posix.pipe();
defer std.os.close(pipefds[0]); defer std.posix.close(pipefds[0]);
var stdout_buf_reader = std.io.bufferedReader((std.fs.File{ .handle = pipefds[0] }).reader()); var stdout_buf_reader = std.io.bufferedReader((std.fs.File{ .handle = pipefds[0] }).reader());
// ChildProcess being useless again... // ChildProcess being useless again...
const pid = try std.os.fork(); const pid = try std.posix.fork();
if (pid == 0) { if (pid == 0) {
errdefer std.os.exit(1); errdefer std.posix.exit(1);
try std.os.dup2(pipefds[1], 1); try std.posix.dup2(pipefds[1], 1);
std.os.close(pipefds[0]); std.posix.close(pipefds[0]);
std.os.close(pipefds[1]); std.posix.close(pipefds[1]);
return std.os.execvpeZ( return std.posix.execvpeZ(
"fish", "fish",
&[_:null]?[*:0]const u8{ "fish", "-c", "complete -C ''" }, &[_:null]?[*:0]const u8{ "fish", "-c", "complete -C ''" },
@ptrCast(std.os.environ.ptr), @ptrCast(std.os.environ.ptr),
); );
} }
std.os.close(pipefds[1]); std.posix.close(pipefds[1]);
var cmd_buf: [1024]u8 = undefined; var cmd_buf: [1024]u8 = undefined;
var fbs = std.io.fixedBufferStream(&cmd_buf); var fbs = std.io.fixedBufferStream(&cmd_buf);
@ -56,5 +56,5 @@ pub fn generate(alloc: std.mem.Allocator) !void {
try cache_file.writer().writeByte('\n'); try cache_file.writer().writeByte('\n');
} }
_ = std.os.waitpid(pid, 0); _ = std.posix.waitpid(pid, 0);
} }

View file

@ -170,7 +170,7 @@ fn correctArgForReq(arena: *std.heap.ArenaAllocator, req: ArgRequirement, arg: *
while (path_spliter.next()) |split| { while (path_spliter.next()) |split| {
if (std.mem.eql(u8, split, "~")) { if (std.mem.eql(u8, split, "~")) {
try path_splits.append(std.os.getenv("HOME") orelse return error.HomeNotSet); try path_splits.append(std.posix.getenv("HOME") orelse return error.HomeNotSet);
} else { } else {
try path_splits.append(split); try path_splits.append(split);
} }

View file

@ -36,15 +36,15 @@ pub fn main() !void {
var cache_file = try std.fs.cwd().openFile(cache_path, .{}); var cache_file = try std.fs.cwd().openFile(cache_path, .{});
defer cache_file.close(); defer cache_file.close();
const cache_content = try std.os.mmap( const cache_content = try std.posix.mmap(
null, null,
(try cache_file.stat()).size, (try cache_file.stat()).size,
std.os.PROT.READ, std.posix.PROT.READ,
.{ .TYPE = .PRIVATE }, .{ .TYPE = .PRIVATE },
cache_file.handle, cache_file.handle,
0, 0,
); );
defer std.os.munmap(cache_content); defer std.posix.munmap(cache_content);
var command_set = std.StringHashMap(void).init(alloc); var command_set = std.StringHashMap(void).init(alloc);
defer command_set.deinit(); defer command_set.deinit();

View file

@ -9,7 +9,7 @@ pub fn main() !void {
if (std.os.argv.len != 2 or !std.mem.eql(u8, std.mem.span(std.os.argv[1]), "fullerscreen")) if (std.os.argv.len != 2 or !std.mem.eql(u8, std.mem.span(std.os.argv[1]), "fullerscreen"))
return error.InvalidArgs; return error.InvalidArgs;
const inst_sig = std.os.getenv("HYPRLAND_INSTANCE_SIGNATURE") orelse const inst_sig = std.posix.getenv("HYPRLAND_INSTANCE_SIGNATURE") orelse
return error.MissingInstanceSignature; return error.MissingInstanceSignature;
var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var gpa = std.heap.GeneralPurposeAllocator(.{}){};

View file

@ -44,7 +44,7 @@ pub fn main() void {
} }
std.debug.print("Encountered fatal error (check log), starting emergency shell!\n", .{}); std.debug.print("Encountered fatal error (check log), starting emergency shell!\n", .{});
@panic(@errorName(std.os.execveZ( @panic(@errorName(std.posix.execveZ(
"/bin/sh", "/bin/sh",
&[_:null]?[*:0]const u8{"/bin/sh"}, &[_:null]?[*:0]const u8{"/bin/sh"},
&[_:null]?[*:0]const u8{}, &[_:null]?[*:0]const u8{},
@ -187,7 +187,7 @@ fn ui(buf_writer: anytype, entries: []command.Command) !command.Command {
var style: ?at.style.Style = null; var style: ?at.style.Style = null;
try @import("figlet.zig").writeFiglet(w); try @import("figlet.zig").writeFiglet(w);
const uname = std.os.uname(); const uname = std.posix.uname();
try updateStyle(w, .{ .foreground = .Yellow }, &style); try updateStyle(w, .{ .foreground = .Yellow }, &style);
try w.print( try w.print(
"\n {s} {s} {s}\n\n", "\n {s} {s} {s}\n\n",
@ -212,11 +212,11 @@ fn ui(buf_writer: anytype, entries: []command.Command) !command.Command {
try buf_writer.flush(); try buf_writer.flush();
const old_termios = try std.os.tcgetattr(std.os.STDIN_FILENO); const old_termios = try std.posix.tcgetattr(std.posix.STDIN_FILENO);
var new_termios = old_termios; var new_termios = old_termios;
new_termios.lflag.ICANON = false; // No line buffering new_termios.lflag.ICANON = false; // No line buffering
new_termios.lflag.ECHO = false; // No echoing stuff new_termios.lflag.ECHO = false; // No echoing stuff
try std.os.tcsetattr(std.os.STDIN_FILENO, .NOW, new_termios); try std.posix.tcsetattr(std.posix.STDIN_FILENO, .NOW, new_termios);
var cmd: ?command.Command = null; var cmd: ?command.Command = null;
var c: [1]u8 = undefined; var c: [1]u8 = undefined;
@ -233,7 +233,7 @@ fn ui(buf_writer: anytype, entries: []command.Command) !command.Command {
try buf_writer.flush(); try buf_writer.flush();
} }
} }
try std.os.tcsetattr(std.os.STDIN_FILENO, .NOW, old_termios); try std.posix.tcsetattr(std.posix.STDIN_FILENO, .NOW, old_termios);
return cmd.?; return cmd.?;
} }

View file

@ -19,7 +19,7 @@ pub fn main() !void {
if (std.mem.eql(u8, verb, "ping")) { if (std.mem.eql(u8, verb, "ping")) {
const client = try Client.connect( const client = try Client.connect(
std.os.getenv("MZTEINIT_SOCKET") orelse return error.SocketPathUnknown, std.posix.getenv("MZTEINIT_SOCKET") orelse return error.SocketPathUnknown,
); );
defer client.deinit(); defer client.deinit();
@ -28,7 +28,7 @@ pub fn main() !void {
if (std.os.argv.len < 3) if (std.os.argv.len < 3)
return error.InvalidArgs; return error.InvalidArgs;
const client = if (std.os.getenv("MZTEINIT_SOCKET")) |sockpath| const client = if (std.posix.getenv("MZTEINIT_SOCKET")) |sockpath|
try Client.connect(sockpath) try Client.connect(sockpath)
else nosock: { else nosock: {
std.log.warn("MZTEINIT_SOCKET not set", .{}); std.log.warn("MZTEINIT_SOCKET not set", .{});
@ -44,7 +44,7 @@ pub fn main() !void {
const val = mzteinit_val orelse getenv: { const val = mzteinit_val orelse getenv: {
std.log.warn("Variable not known to MZTEINIT, falling back to current environment.", .{}); std.log.warn("Variable not known to MZTEINIT, falling back to current environment.", .{});
break :getenv std.os.getenv(std.mem.span(std.os.argv[2])); break :getenv std.posix.getenv(std.mem.span(std.os.argv[2]));
}; };
if (val) |v| { if (val) |v| {

View file

@ -48,7 +48,7 @@ pub fn fmtCommand(cmd: []const []const u8) std.fmt.Formatter(formatCommand) {
} }
pub fn findInPath(alloc: std.mem.Allocator, bin: []const u8) !?[]const u8 { pub fn findInPath(alloc: std.mem.Allocator, bin: []const u8) !?[]const u8 {
const path = std.os.getenv("PATH") orelse return null; const path = std.posix.getenv("PATH") orelse return null;
var splits = std.mem.split(u8, path, ":"); var splits = std.mem.split(u8, path, ":");
while (splits.next()) |p| { while (splits.next()) |p| {

View file

@ -5,8 +5,8 @@
.dependencies = .{ .dependencies = .{
.common = .{ .path = "../../lib/common-zig" }, .common = .{ .path = "../../lib/common-zig" },
.wayland = .{ .wayland = .{
.url = "git+https://git.mzte.de/LordMZTE/zig-wayland#4de9f2d6d5fddae1fbb29e21fd1dae69e646ab7d", .url = "git+https://git.mzte.de/LordMZTE/zig-wayland#4f4ade382d582845b092de450527e3e7e0133f07",
.hash = "1220d6448c277e5c41348aa95ce2ba2fc92a92cb7a9e9783edf0f816cd0260122d31", .hash = "122087ee3bdff43049bf1d58513622c5f3c1430308665af0ee8961a22b60c4c10c1a",
}, },
}, },

View file

@ -163,7 +163,7 @@ pub fn init(alloc: std.mem.Allocator, initial: bool) !void {
try con.runCommand(&.{ "default-layout", "rivertile" }); try con.runCommand(&.{ "default-layout", "rivertile" });
const home = std.os.getenv("HOME") orelse return error.HomeNotSet; const home = std.posix.getenv("HOME") orelse return error.HomeNotSet;
const init_path = try std.fs.path.join( const init_path = try std.fs.path.join(
alloc, alloc,
&.{ home, ".config", "mzte_localconf", "river_init" }, &.{ home, ".config", "mzte_localconf", "river_init" },

View file

@ -43,8 +43,8 @@ pub fn main() !void {
std.log.info("river log file: {s}", .{logf_path}); std.log.info("river log file: {s}", .{logf_path});
break :logf try std.os.openatZ( break :logf try std.posix.openatZ(
std.os.AT.FDCWD, std.posix.AT.FDCWD,
logf_path.ptr, logf_path.ptr,
// no CLOEXEC // no CLOEXEC
.{ .{
@ -56,13 +56,13 @@ pub fn main() !void {
); );
}; };
{ {
errdefer std.os.close(logfd); errdefer std.posix.close(logfd);
// redirect river's STDERR and STDOUT to log file // redirect river's STDERR and STDOUT to log file
try std.os.dup2(logfd, std.os.STDOUT_FILENO); try std.posix.dup2(logfd, std.posix.STDOUT_FILENO);
try std.os.dup2(logfd, std.os.STDERR_FILENO); try std.posix.dup2(logfd, std.posix.STDERR_FILENO);
} }
std.os.close(logfd); std.posix.close(logfd);
var env = std.BoundedArray(?[*:0]const u8, 0xff).init(0) catch unreachable; var env = std.BoundedArray(?[*:0]const u8, 0xff).init(0) catch unreachable;
const envp: [*:null]?[*:0]const u8 = env: { const envp: [*:null]?[*:0]const u8 = env: {
@ -81,6 +81,6 @@ pub fn main() !void {
break :env @ptrCast(env.slice().ptr); break :env @ptrCast(env.slice().ptr);
}; };
return std.os.execvpeZ("river", &[_:null]?[*:0]const u8{"river"}, envp); return std.posix.execvpeZ("river", &[_:null]?[*:0]const u8{"river"}, envp);
} }
} }

View file

@ -10,7 +10,7 @@ pub fn main() !u8 {
defer _ = gpa.deinit(); defer _ = gpa.deinit();
const alloc = gpa.allocator(); const alloc = gpa.allocator();
var file_buf: [std.os.PATH_MAX]u8 = undefined; var file_buf: [std.posix.PATH_MAX]u8 = undefined;
const file = try findVideoFile(alloc, &file_buf); const file = try findVideoFile(alloc, &file_buf);
try std.io.getStdOut().writer().print("playing: `{s}`\n", .{file}); try std.io.getStdOut().writer().print("playing: `{s}`\n", .{file});
@ -68,11 +68,11 @@ fn findVideoFile(alloc: std.mem.Allocator, out_buf: []u8) ![]const u8 {
fn promtForDeletion(file: []const u8) !bool { fn promtForDeletion(file: []const u8) !bool {
try std.io.getStdOut().writer().print("delete file `{s}`? [Y/N] ", .{file}); try std.io.getStdOut().writer().print("delete file `{s}`? [Y/N] ", .{file});
const old_termios = try std.os.tcgetattr(std.os.STDIN_FILENO); const old_termios = try std.posix.tcgetattr(std.posix.STDIN_FILENO);
var new_termios = old_termios; var new_termios = old_termios;
new_termios.lflag.ICANON = false; // No line buffering new_termios.lflag.ICANON = false; // No line buffering
try std.os.tcsetattr(std.os.STDIN_FILENO, .NOW, new_termios); try std.posix.tcsetattr(std.posix.STDIN_FILENO, .NOW, new_termios);
defer std.os.tcsetattr(std.os.STDIN_FILENO, .NOW, old_termios) catch {}; defer std.posix.tcsetattr(std.posix.STDIN_FILENO, .NOW, old_termios) catch {};
const answer = try std.io.getStdIn().reader().readByte(); const answer = try std.io.getStdIn().reader().readByte();
const ret = switch (answer) { const ret = switch (answer) {

View file

@ -31,23 +31,23 @@ pub fn main() !void {
const options = prompt.Options{ const options = prompt.Options{
.status = try std.fmt.parseInt( .status = try std.fmt.parseInt(
i16, i16,
std.os.getenv("MZPROMPT_STATUS") orelse std.posix.getenv("MZPROMPT_STATUS") orelse
return error.MissingEnv, return error.MissingEnv,
10, 10,
), ),
.mode = FishMode.parse( .mode = FishMode.parse(
std.os.getenv("MZPROMPT_FISH_MODE") orelse std.posix.getenv("MZPROMPT_FISH_MODE") orelse
return error.MissingEnv, return error.MissingEnv,
), ),
.duration = try std.fmt.parseInt( .duration = try std.fmt.parseInt(
u32, u32,
std.os.getenv("MZPROMPT_DURATION") orelse std.posix.getenv("MZPROMPT_DURATION") orelse
return error.MissingEnv, return error.MissingEnv,
10, 10,
), ),
.jobs = try std.fmt.parseInt( .jobs = try std.fmt.parseInt(
u32, u32,
std.os.getenv("MZPROMPT_JOBS") orelse std.posix.getenv("MZPROMPT_JOBS") orelse
return error.MissingEnv, return error.MissingEnv,
10, 10,
), ),

View file

@ -149,7 +149,7 @@ fn Renderer(comptime Writer: type) type {
fn renderCwd(self: *Self) !void { fn renderCwd(self: *Self) !void {
var cwd_buf: [512]u8 = undefined; var cwd_buf: [512]u8 = undefined;
const cwd = try std.os.getcwd(&cwd_buf); const cwd = try std.posix.getcwd(&cwd_buf);
const home_path = (try known_folders.getPath(std.heap.c_allocator, .home)); const home_path = (try known_folders.getPath(std.heap.c_allocator, .home));

View file

@ -9,8 +9,8 @@ pub const std_options = std.Options{
pub fn main() !u8 { pub fn main() !u8 {
const alloc = std.heap.c_allocator; const alloc = std.heap.c_allocator;
const home_s = std.os.getenv("HOME") orelse return error.HomeNotSet; const home_s = std.posix.getenv("HOME") orelse return error.HomeNotSet;
const runtime_dir = std.os.getenv("XDG_RUNTIME_DIR") orelse return error.MissingRuntimeDir; const runtime_dir = std.posix.getenv("XDG_RUNTIME_DIR") orelse return error.MissingRuntimeDir;
var walker = Walker.init(alloc); var walker = Walker.init(alloc);
defer walker.deinit(); defer walker.deinit();

View file

@ -5,8 +5,8 @@
.dependencies = .{ .dependencies = .{
.common = .{ .path = "../../lib/common-zig" }, .common = .{ .path = "../../lib/common-zig" },
.wayland = .{ .wayland = .{
.url = "git+https://git.mzte.de/LordMZTE/zig-wayland#4de9f2d6d5fddae1fbb29e21fd1dae69e646ab7d", .url = "git+https://git.mzte.de/LordMZTE/zig-wayland#4f4ade382d582845b092de450527e3e7e0133f07",
.hash = "1220d6448c277e5c41348aa95ce2ba2fc92a92cb7a9e9783edf0f816cd0260122d31", .hash = "122087ee3bdff43049bf1d58513622c5f3c1430308665af0ee8961a22b60c4c10c1a",
}, },
}, },
} }

View file

@ -50,9 +50,9 @@ const PopupWindow = struct {
const stride = width * 4; const stride = width * 4;
const size = stride * height; // 1x1x4 bytes const size = stride * height; // 1x1x4 bytes
const memfd = try std.os.memfd_create("surface_shm", 0); const memfd = try std.posix.memfd_create("surface_shm", 0);
defer std.os.close(memfd); defer std.posix.close(memfd);
try std.os.ftruncate(memfd, size); try std.posix.ftruncate(memfd, size);
const shm_pool = try cc.shm.createPool(memfd, size); const shm_pool = try cc.shm.createPool(memfd, size);
errdefer shm_pool.destroy(); errdefer shm_pool.destroy();
@ -123,9 +123,9 @@ pub fn deinit(self: *ClipboardConnection) void {
self.* = undefined; self.* = undefined;
} }
pub fn getContent(self: *ClipboardConnection, out_fd: std.os.fd_t) !void { pub fn getContent(self: *ClipboardConnection, out_fd: std.posix.fd_t) !void {
const DataDeviceListener = struct { const DataDeviceListener = struct {
out_fd: std.os.fd_t, out_fd: std.posix.fd_t,
display: *wl.Display, display: *wl.Display,
fn onEvent(_: *wl.DataDevice, ev: wl.DataDevice.Event, ddl: *@This()) void { fn onEvent(_: *wl.DataDevice, ev: wl.DataDevice.Event, ddl: *@This()) void {

View file

@ -83,15 +83,15 @@ pub fn main() !void {
std.log.info("mmapping tempfile", .{}); std.log.info("mmapping tempfile", .{});
const fcontent = try std.os.mmap( const fcontent = try std.posix.mmap(
null, null,
stat.size, stat.size,
std.os.PROT.READ, std.posix.PROT.READ,
.{ .TYPE = .PRIVATE }, .{ .TYPE = .PRIVATE },
tempfile.handle, tempfile.handle,
0, 0,
); );
defer std.os.munmap(fcontent); defer std.posix.munmap(fcontent);
try cp.serveContent(std.mem.trim(u8, fcontent, " \n\r")); try cp.serveContent(std.mem.trim(u8, fcontent, " \n\r"));
} }

View file

@ -5,12 +5,12 @@
.dependencies = .{ .dependencies = .{
.common = .{ .path = "../../lib/common-zig" }, .common = .{ .path = "../../lib/common-zig" },
.wayland = .{ .wayland = .{
.url = "git+https://git.mzte.de/LordMZTE/zig-wayland#4de9f2d6d5fddae1fbb29e21fd1dae69e646ab7d", .url = "git+https://git.mzte.de/LordMZTE/zig-wayland#4f4ade382d582845b092de450527e3e7e0133f07",
.hash = "1220d6448c277e5c41348aa95ce2ba2fc92a92cb7a9e9783edf0f816cd0260122d31", .hash = "122087ee3bdff43049bf1d58513622c5f3c1430308665af0ee8961a22b60c4c10c1a",
}, },
.xev = .{ .xev = .{
.url = "git+https://github.com/mitchellh/libxev#418cac65473668b02cc5a85194042bdaf04acd00", .url = "git+https://github.com/mitchellh/libxev#0f73adfda1cff9c740160717b5431ebada6b8755",
.hash = "12203116ff408eb48f81c947dfeb06f7feebf6a9efa962a560ac69463098b2c04a96", .hash = "12203dcbe098ee49ea242432cd198b1ca557626988f056bea86630dcfe8660244407",
}, },
}, },
} }