Compare commits

...

3 commits

Author SHA1 Message Date
b074fc0376
mzteinit: initialize XDG_DATA_DIRS 2024-06-21 20:05:49 +02:00
5312df2643
librewolf config changes 2024-06-21 18:46:40 +02:00
76752e1c33
port all Zig code to Zig 0.13.0 2024-06-21 18:43:42 +02:00
53 changed files with 81 additions and 573 deletions

View file

@ -1 +0,0 @@
alecor printfish | source

View file

@ -1,2 +1,3 @@
set editorcmd neovide
set theme midnight
set smoothscroll true

4
.gitignore vendored
View file

@ -1,2 +1,6 @@
# confgen output
cgout
# Zig build outputs
**/zig-out
**/.zig-cache

View file

@ -15,3 +15,7 @@ defaultPref("widget.use-xdg-desktop-portal.file-picker", 0);
[
"cache", "cookiesAndStorage"
].forEach(s => defaultPref(`privacy.clearOnShutdown_v2.${s}`, false))
// Needs to be disabled to enable dark mode
defaultPref("privacy.resistFingerprinting", false);
// TODO: somehow enable dark mode declaratively

View file

@ -1 +0,0 @@
/zig-*

View file

@ -4,7 +4,7 @@ pub const confgen_json_opt = std.json.ParseOptions{ .ignore_unknown_fields = tru
pub fn build(b: *std.Build) void {
_ = b.addModule("common", .{
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
});
}

5
mzte-nv/.gitignore vendored
View file

@ -1,5 +0,0 @@
zig-cache/
zig-out/
deps.zig
gyro.lock
.gyro

View file

@ -12,7 +12,7 @@ pub fn build(b: *std.Build) !void {
const lib = b.addSharedLibrary(.{
.name = "mzte-nv",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = mode,
});
@ -55,7 +55,7 @@ pub fn build(b: *std.Build) !void {
// this is the install step for the lua config compiler binary
const compiler = b.addExecutable(.{
.name = "mzte-nv-compile",
.root_source_file = .{ .path = "src/compiler.zig" },
.root_source_file = b.path("src/compiler.zig"),
.target = target,
.optimize = mode,
});

View file

@ -5,8 +5,8 @@
.dependencies = .{
.common = .{ .path = "../lib/common-zig" },
.znvim = .{
.url = "git+https://git.mzte.de/LordMZTE/znvim.git#8e52c461dc071e6b88c8e77e49aa2805f225e7da",
.hash = "122029929d792aa32a71c0b98bb67d344d971d269d6fea5b8f8693e29f0f45924951",
.url = "git+https://git.mzte.de/LordMZTE/znvim.git#593576ab90fe7745acef03b88849aa904c399731",
.hash = "122036fae770b609b5eca343a07dd735522f90c93f9ae1a5f89bc24480f5906cd777",
},
},
.paths = .{""},

View file

@ -1 +0,0 @@
/zig-*

View file

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
const lib = b.addSharedLibrary(.{
.name = "mzte-mpv",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.link_libc = true,
.target = target,
.optimize = optimize,

View file

@ -12,7 +12,7 @@ skipped_chapters: ChapterSet,
const SBSkip = @This();
const blacklist = std.ComptimeStringMap(void, .{
const blacklist = std.StaticStringMap(void).initComptime(.{
.{ "Endcards/Credits", {} },
.{ "Interaction Reminder", {} },
.{ "Intermission/Intro Animation", {} },

View file

@ -1 +0,0 @@
/zig-*

View file

@ -1,27 +0,0 @@
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "alecor",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("common", b.dependency("common", .{}).module("common"));
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
}

View file

@ -1,8 +0,0 @@
.{
.name = "alecor",
.version = "0.0.0",
.paths = .{""},
.dependencies = .{
.common = .{ .path = "../../lib/common-zig" },
},
}

View file

@ -1,60 +0,0 @@
const std = @import("std");
pub fn commandsCachePath(alloc: std.mem.Allocator) ![]const u8 {
return try std.fs.path.join(alloc, &.{
std.posix.getenv("HOME") orelse return error.HomeNotSet,
".cache",
"alecor",
"commands",
});
}
pub fn generate(alloc: std.mem.Allocator) !void {
const cache_path = try commandsCachePath(alloc);
defer alloc.free(cache_path);
if (std.fs.path.dirname(cache_path)) |cache_dir| {
try std.fs.cwd().makePath(cache_dir);
}
var cache_file = try std.fs.cwd().createFile(cache_path, .{});
defer cache_file.close();
const pipefds = try std.posix.pipe();
defer std.posix.close(pipefds[0]);
var stdout_buf_reader = std.io.bufferedReader((std.fs.File{ .handle = pipefds[0] }).reader());
// ChildProcess being useless again...
const pid = try std.posix.fork();
if (pid == 0) {
errdefer std.posix.exit(1);
try std.posix.dup2(pipefds[1], 1);
std.posix.close(pipefds[0]);
std.posix.close(pipefds[1]);
return std.posix.execvpeZ(
"fish",
&[_:null]?[*:0]const u8{ "fish", "-c", "complete -C ''" },
@ptrCast(std.os.environ.ptr),
);
}
std.posix.close(pipefds[1]);
var cmd_buf: [1024]u8 = undefined;
var fbs = std.io.fixedBufferStream(&cmd_buf);
while (true) {
fbs.reset();
stdout_buf_reader.reader().streamUntilDelimiter(fbs.writer(), '\n', null) catch |e| switch (e) {
error.EndOfStream => break,
else => return e,
};
// FBS will have <cmd>\tgarbage here
var spliter = std.mem.tokenize(u8, fbs.getWritten(), "\t");
try cache_file.writeAll(spliter.next() orelse continue);
try cache_file.writer().writeByte('\n');
}
_ = std.posix.waitpid(pid, 0);
}

View file

@ -1,224 +0,0 @@
const std = @import("std");
const util = @import("util.zig");
/// Commands which are prioritized for correction
const priority_commands = [_][]const u8{
"git",
};
/// Commands which wrap another
const wrapper_commands = std.ComptimeStringMap(void, .{
.{ "doas", {} },
.{ "sudo", {} },
.{ "rbg", {} },
.{ "rbgd", {} },
.{ "pkexec", {} },
});
fn populateArgMap(map: *ArgMap) !void {
try map.put(&.{"git"}, .{ .subcommand = &.{ "push", "pull", "reset", "checkout" } });
try map.put(&.{ "git", "checkout" }, .file_or_directory);
}
const ArgRequirement = union(enum) {
subcommand: []const []const u8,
file,
directory,
file_or_directory,
};
const ArgMap = std.HashMap(
[]const []const u8,
ArgRequirement,
struct {
pub fn hash(self: @This(), v: []const []const u8) u64 {
_ = self;
var hasher = std.hash.Wyhash.init(0);
hasher.update(std.mem.asBytes(&v.len));
for (v) |s| {
hasher.update(std.mem.asBytes(&v.len));
hasher.update(s);
}
return hasher.final();
}
pub fn eql(self: @This(), a: []const []const u8, b: []const []const u8) bool {
_ = self;
if (a.len != b.len)
return false;
for (a, b) |va, vb|
if (!std.mem.eql(u8, va, vb))
return false;
return true;
}
},
std.hash_map.default_max_load_percentage,
);
pub fn correctCommand(
arena: *std.heap.ArenaAllocator,
/// Command to correct in-place
cmd: [][]const u8,
/// Set of all valid commands
commands: *std.StringHashMap(void),
) !void {
const alloc = arena.child_allocator;
var subslice = cmd;
// skip wrapper commands
while (subslice.len > 0 and wrapper_commands.has(subslice[0]))
subslice = subslice[1..];
// empty command
if (subslice.len == 0)
return;
if (!commands.contains(subslice[0])) {
// correct command
var best: ?struct { []const u8, usize } = null;
// do priority commands first and sub 1 from distance
for (priority_commands) |possible_cmd| {
const dist = try util.dist(alloc, subslice[0], possible_cmd) -| 1; // prioritize by subtracting 1
if (best == null or best.?.@"1" > dist)
best = .{ possible_cmd, dist };
}
if (best != null and best.?.@"1" != 0) {
var iter = commands.keyIterator();
while (iter.next()) |possible_cmd| {
const dist = try util.dist(alloc, subslice[0], possible_cmd.*);
if (best == null or best.?.@"1" > dist)
best = .{ possible_cmd.*, dist };
}
}
if (best) |b| {
if (!std.mem.eql(u8, subslice[0], b.@"0")) {
std.log.info("[C] {s} => {s}", .{ subslice[0], b.@"0" });
subslice[0] = b.@"0";
}
}
}
if (subslice.len < 2)
return;
var arg_map = ArgMap.init(alloc);
defer arg_map.deinit();
try populateArgMap(&arg_map);
// correct args. loop as long as corrections are made
while (true) {
var req: ?ArgRequirement = null;
var cmd_slice_end = subslice.len - 1;
while (cmd_slice_end >= 1) : (cmd_slice_end -= 1) {
if (arg_map.get(subslice[0..cmd_slice_end])) |r| {
req = r;
cmd_slice_end -= 1;
break;
}
}
// If the argument contains a slash, assume it's a path.
if (req == null and std.mem.containsAtLeast(u8, subslice[cmd_slice_end + 1], 1, "/"))
req = .file_or_directory;
if (req) |r| {
var new_arg = subslice[cmd_slice_end + 1];
try correctArgForReq(arena, r, &new_arg);
if (!std.mem.eql(u8, subslice[cmd_slice_end + 1], new_arg)) {
std.log.info("[A] {s} => {s}", .{ subslice[cmd_slice_end + 1], new_arg });
subslice[cmd_slice_end + 1] = new_arg;
} else break;
} else break;
}
}
fn correctArgForReq(arena: *std.heap.ArenaAllocator, req: ArgRequirement, arg: *[]const u8) !void {
const alloc = arena.child_allocator;
switch (req) {
.subcommand => |subcmds| {
var best: ?struct { []const u8, usize } = null;
for (subcmds) |possible_cmd| {
const dist = try util.dist(alloc, arg.*, possible_cmd);
if (best == null or best.?.@"1" > dist)
best = .{ possible_cmd, dist };
}
if (best) |b|
arg.* = b.@"0";
},
.file, .directory, .file_or_directory => {
if (arg.len == 0)
return;
var path_spliter = std.mem.tokenize(u8, arg.*, "/");
var path_splits = std.ArrayList([]const u8).init(alloc);
defer path_splits.deinit();
// path is absolute
if (arg.*[0] == '/')
try path_splits.append("/");
while (path_spliter.next()) |split| {
if (std.mem.eql(u8, split, "~")) {
try path_splits.append(std.posix.getenv("HOME") orelse return error.HomeNotSet);
} else {
try path_splits.append(split);
}
}
for (path_splits.items, 0..) |*split, cur_idx| {
const dirs = path_splits.items[0..cur_idx];
const dir_subpath = try std.fs.path.join(arena.allocator(), if (dirs.len == 0) &.{"."} else dirs);
var iterable_dir = try std.fs.cwd().openDir(dir_subpath, .{ .iterate = true });
defer iterable_dir.close();
// if the given file already exists, there's no point in iterating the dir
if (iterable_dir.statFile(split.*)) |_| continue else |e| switch (e) {
error.FileNotFound => {},
else => return e,
}
var best: ?struct { []const u8, usize } = null;
var dir_iter = iterable_dir.iterate();
var best_buf: [1024]u8 = undefined;
while (try dir_iter.next()) |entry| {
switch (req) {
.file => if (entry.kind == .directory) continue,
.directory => if (entry.kind != .directory and
entry.kind != .sym_link) continue,
else => {},
}
const dist = try util.dist(alloc, split.*, entry.name);
if (best == null or best.?.@"1" > dist) {
if (entry.name.len > best_buf.len)
return error.OutOfMemory;
const buf_slice = best_buf[0..entry.name.len];
@memcpy(buf_slice, entry.name);
best = .{ buf_slice, dist };
}
}
if (best) |b| {
split.* = try arena.allocator().dupe(u8, b.@"0");
} else break;
}
arg.* = try std.fs.path.join(arena.allocator(), path_splits.items);
},
}
}

View file

@ -1,73 +0,0 @@
const std = @import("std");
const cache = @import("cache.zig");
const util = @import("util.zig");
pub const std_options = std.Options{
.log_level = .debug,
.logFn = @import("common").logFn,
};
pub fn main() !void {
if (std.os.argv.len < 2)
return error.NotEnoughArguments;
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const alloc = gpa.allocator();
const subcmd = std.mem.span(std.os.argv[1]);
if (std.mem.eql(u8, subcmd, "doalec")) {
if (std.os.argv.len < 3)
return error.NotEnoughArguments;
var args = std.ArrayList([]const u8).init(alloc);
defer args.deinit();
var spliter = std.mem.tokenize(u8, std.mem.span(std.os.argv[2]), "\n");
while (spliter.next()) |arg|
try args.append(arg);
// open and map cache
const cache_path = try cache.commandsCachePath(alloc);
defer alloc.free(cache_path);
var cache_file = try std.fs.cwd().openFile(cache_path, .{});
defer cache_file.close();
const cache_content = try std.posix.mmap(
null,
(try cache_file.stat()).size,
std.posix.PROT.READ,
.{ .TYPE = .PRIVATE },
cache_file.handle,
0,
);
defer std.posix.munmap(cache_content);
var command_set = std.StringHashMap(void).init(alloc);
defer command_set.deinit();
var cache_tok = std.mem.tokenize(u8, cache_content, "\n");
while (cache_tok.next()) |tok|
if (tok.len != 0)
try command_set.put(tok, {});
var arena = std.heap.ArenaAllocator.init(alloc);
defer arena.deinit();
try @import("correct.zig").correctCommand(&arena, args.items, &command_set);
try std.io.getStdOut().writer().print("{}\n", .{util.fmtCommand(args.items)});
} else if (std.mem.eql(u8, subcmd, "printfish")) {
try std.io.getStdOut().writer().print(
\\function alec --description 'ALEC'
\\ commandline (builtin history search -n 1)
\\ commandline ({s} doalec (commandline -o | string split0))
\\end
\\
, .{std.os.argv[0]});
} else if (std.mem.eql(u8, subcmd, "mkcache")) {
try cache.generate(alloc);
} else return error.UnknownCommand;
}

View file

@ -1,100 +0,0 @@
const std = @import("std");
/// A 2-dimensional heap-allocated matrix.
pub fn Matrix2D(comptime T: type) type {
return struct {
data: []T,
width: usize,
const Self = @This();
pub inline fn init(alloc: std.mem.Allocator, height: usize, width: usize) !Self {
return .{ .data = try alloc.alloc(T, height * width), .width = width };
}
pub inline fn deinit(self: Self, alloc: std.mem.Allocator) void {
alloc.free(self.data);
}
pub inline fn el(self: *Self, row: usize, col: usize) *T {
return &self.data[row * self.width + col];
}
};
}
/// Calculates the Damerau-Levenshtein distance between 2 strings
pub fn dist(alloc: std.mem.Allocator, a: []const u8, b: []const u8) !usize {
var d = try Matrix2D(usize).init(alloc, a.len + 1, b.len + 1);
defer d.deinit(alloc);
@memset(d.data, 0);
var i: usize = 0;
var j: usize = 0;
while (i <= a.len) : (i += 1) {
d.el(i, 0).* = i;
}
while (j <= b.len) : (j += 1) {
d.el(0, j).* = j;
}
i = 1;
while (i <= a.len) : (i += 1) {
j = 1;
while (j <= b.len) : (j += 1) {
const cost = @intFromBool(a[i - 1] != b[j - 1]);
d.el(i, j).* = @min(
d.el(i - 1, j).* + 1, // deletion
@min(
d.el(i, j - 1).* + 1, // insertion
d.el(i - 1, j - 1).* + cost, // substitution
),
);
// transposition
if (i > 1 and j > 1 and a[i - 1] == b[j - 2] and a[i - 2] == b[j - 1])
d.el(i, j).* = @min(d.el(i, j).*, d.el(i - 2, j - 2).* + cost);
}
}
return d.el(a.len, b.len).*;
}
fn formatCommand(
cmd: []const []const u8,
comptime fmt: []const u8,
options: std.fmt.FormatOptions,
writer: anytype,
) !void {
_ = options;
_ = fmt;
var first = true;
for (cmd) |arg| {
defer first = false;
var needs_quote = false;
for (arg) |ch| {
if (!std.ascii.isPrint(ch) or ch == '\'' or ch == ' ' or ch == '*' or ch == '$') {
needs_quote = true;
break;
}
}
if (!first)
try writer.writeByte(' ');
if (needs_quote) {
try writer.writeByte('"');
try writer.print("{}", .{std.fmt.fmtSliceEscapeUpper(arg)});
try writer.writeByte('"');
} else {
try writer.writeAll(arg);
}
}
}
pub fn fmtCommand(cmd: []const []const u8) std.fmt.Formatter(formatCommand) {
return .{ .data = cmd };
}

View file

@ -1 +0,0 @@
/zig-*

View file

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "hyprtool",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});

View file

@ -1,3 +0,0 @@
zig-cache/
zig-out/
flake.lock

View file

@ -10,14 +10,14 @@ pub fn build(b: *std.Build) !void {
const exe = b.addExecutable(.{
.name = "mzteinit",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
const mzteinitctl = b.addExecutable(.{
.name = "mzteinitctl",
.root_source_file = .{ .path = "src/mzteinitctl.zig" },
.root_source_file = b.path("src/mzteinitctl.zig"),
.target = target,
.optimize = optimize,
});
@ -28,7 +28,7 @@ pub fn build(b: *std.Build) !void {
}
const cg_opt = try common.confgenGet(struct {
gtk_theme: []u8, // TODO: this being non-const is a workaround for an std bug
gtk_theme: []const u8,
}, b.allocator);
const opts = b.addOptions();

View file

@ -5,8 +5,8 @@
.dependencies = .{
.common = .{ .path = "../../lib/common-zig" },
.ansi_term = .{
.url = "git+https://github.com/LordMZTE/ansi-term.git#73c03175068679685535111dbea72cade075719e",
.hash = "1220ea86ace34b38e49c1d737c5f857d88346af10695a992b38e10cb0a73b6a19ef7",
.url = "git+https://github.com/LordMZTE/ansi-term.git#86a00a97e5d72d21c8632006c73483c4187b6d98",
.hash = "12200719196e0abd325efa248fb03882c8fa2c7130e3ae1d57dbff72afc846b28495",
},
},
.paths = .{""},

View file

@ -29,7 +29,7 @@ pub const Command = struct {
if (self.exit) exit.* = .immediate;
log.info("run cmd: {s}", .{self.command});
var child = std.ChildProcess.init(self.command, alloc);
var child = std.process.Child.init(self.command, alloc);
{
env.mtx.lock();
defer env.mtx.unlock();

View file

@ -85,6 +85,26 @@ pub fn populateEnvironment(env: *std.process.EnvMap) !bool {
try env.put(kv[0], try std.fmt.bufPrint(&sbuf, "{s}/{s}", .{ home, kv[1] }));
}
// XDG_DATA_DIRS
{
var bufstream = std.io.fixedBufferStream(&buf);
var b = delimitedWriter(bufstream.writer(), ':');
// Default value taken from archwiki.
// https://wiki.archlinux.org/title/XDG_Base_Directory
try b.push(env.get("XDG_DATA_DIRS") orelse "/usr/local/share:/usr/share");
inline for (.{ ".nix-profile/share", ".local/share" }) |base| {
const full = try std.fmt.bufPrint(&sbuf, "{s}/" ++ base, .{home});
if (!std.mem.containsAtLeast(u8, bufstream.getWritten(), 1, full)) {
log.info("adding " ++ base ++ " to XDG_DATA_DIRS", .{});
try b.push(full);
}
}
try env.put("XDG_DATA_DIRS", bufstream.getWritten());
}
// set shell to nu to prevent anything from defaulting to mzteinit
if (try util.findInPath(
alloc,
@ -227,7 +247,7 @@ pub fn populateSysdaemonEnvironment(env: *const std.process.EnvMap) !void {
log.debug("sysdaemon env cmd: {}", .{util.fmtCommand(argv.items)});
var child = std.ChildProcess.init(argv.items, env.hash_map.allocator);
var child = std.process.Child.init(argv.items, env.hash_map.allocator);
const term = try child.spawnAndWait();
if (!std.meta.eql(term, .{ .Exited = 0 })) {

View file

@ -80,7 +80,7 @@ fn tryMain() !void {
if (env_map.data.get("MZTEINIT")) |_| {
try stdout.writer().writeAll("mzteinit running already, starting shell\n");
try stdout.flush();
var child = std.ChildProcess.init(launch_cmd orelse &.{"nu"}, alloc);
var child = std.process.Child.init(launch_cmd orelse &.{"nu"}, alloc);
_ = try child.spawnAndWait();
return;
} else {
@ -121,7 +121,7 @@ fn tryMain() !void {
if (launch_cmd) |cmd| {
try msg("using launch command", .{});
var child = std.ChildProcess.init(cmd, alloc);
var child = std.process.Child.init(cmd, alloc);
{
env_map.mtx.lock();
defer env_map.mtx.unlock();

View file

@ -1,2 +0,0 @@
zig-cache/
zig-out/

View file

@ -43,14 +43,17 @@ pub fn build(b: *std.Build) !void {
const exe = b.addExecutable(.{
.name = "mzteriver",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
scanner.addCSource(exe);
exe.root_module.addImport("common", b.dependency("common", .{}).module("common"));
exe.root_module.addImport("opts", opts.createModule());
exe.root_module.addImport("wayland", scanner.mod);
exe.root_module.addImport("wayland", b.createModule(.{ .root_source_file = scanner.result }));
scanner.addCustomProtocol("river-control-unstable-v1.xml");

View file

@ -5,8 +5,8 @@
.dependencies = .{
.common = .{ .path = "../../lib/common-zig" },
.wayland = .{
.url = "git+https://git.mzte.de/LordMZTE/zig-wayland#1164c9eaa59442e6a8ec8e994fd5d30c23e4ed6d",
.hash = "122064a0e836c603b42720f101cd1b983f9b79f2457b58afdfa1aca1d7c406e80b83",
.url = "git+https://codeberg.org/ifreund/zig-wayland.git#092e3424345d9c0a9467771b2f629fa01560a69f",
.hash = "1220ab835f090bde18b74191e88c4ab3bd49364d310bd9912eccebd3c47bad7957a3",
},
},

View file

@ -1,5 +0,0 @@
zig-cache/
zig-out/
deps.zig
gyro.lock
.gyro

View file

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "openbrowser",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = mode,
});
@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void {
b.installArtifact(exe);
const desktop_install_step = b.addInstallFile(
.{ .path = "assets/openbrowser.desktop" },
b.path("assets/openbrowser.desktop"),
"share/applications/openbrowser.desktop",
);
b.getInstallStep().dependOn(&desktop_install_step.step);

View file

@ -60,6 +60,6 @@ fn start(browser: []const u8, alloc: std.mem.Allocator) !void {
std.log.info("child argv: {s}", .{argv});
var child = std.ChildProcess.init(argv, alloc);
var child = std.process.Child.init(argv, alloc);
_ = try child.spawnAndWait();
}

View file

@ -1,3 +0,0 @@
zig-cache/
zig-out/
flake.lock

View file

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "playvid",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});

View file

@ -1,4 +0,0 @@
zig-*/
.gyro/
deps.zig
gyro.lock

View file

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "prompt",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = mode,
});

View file

@ -6,12 +6,12 @@
.dependencies = .{
.common = .{ .path = "../../lib/common-zig" },
.ansi_term = .{
.url = "git+https://github.com/LordMZTE/ansi-term.git#73c03175068679685535111dbea72cade075719e",
.hash = "1220ea86ace34b38e49c1d737c5f857d88346af10695a992b38e10cb0a73b6a19ef7",
.url = "git+https://github.com/LordMZTE/ansi-term.git#86a00a97e5d72d21c8632006c73483c4187b6d98",
.hash = "12200719196e0abd325efa248fb03882c8fa2c7130e3ae1d57dbff72afc846b28495",
},
.known_folders = .{
.url = "git+https://github.com/ziglibs/known-folders.git#2aa7f2e9855d45b20072e15107fb379b9380adbe",
.hash = "12209925016f4b5486a713828ead3bcc900fa4f039c93de1894aa7d5253f7633b92c",
.url = "git+https://github.com/ziglibs/known-folders.git#47076c6b11214a218e9244471d8762310820911a",
.hash = "12209d2738a2e1dbd3781c2e5f01a2ea877dcfeea53efdfa1913247297d328e6b207",
},
},
}

View file

@ -1,2 +0,0 @@
zig-cache/
zig-out/

View file

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "randomwallpaper",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = mode,
});

View file

@ -23,7 +23,6 @@
(apply cmd (if (noint)
'("paru" "-Syu" "--noconfirm")
'("paru" "-Syu")))
(cmd "alecor" "mkcache")
(cmd "tldr" "--update")
(unless (empty? failures)

View file

@ -1,5 +0,0 @@
zig-cache/
zig-out/
deps.zig
gyro.lock
.gyro

View file

@ -7,13 +7,14 @@ pub fn build(b: *std.Build) void {
const mode = b.standardOptimizeOption(.{});
const scanner = Scanner.create(b, .{});
const wayland_mod = scanner.mod;
const wayland_mod = b.createModule(.{ .root_source_file = scanner.result });
const exe = b.addExecutable(.{
.name = "vinput",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = mode,
.link_libc = true,
});
exe.root_module.addImport("common", b.dependency("common", .{}).module("common"));
@ -27,6 +28,8 @@ pub fn build(b: *std.Build) void {
scanner.generate("wl_shm", 1);
scanner.generate("xdg_wm_base", 2);
scanner.addCSource(exe);
exe.root_module.linkSystemLibrary("wayland-client", .{});
b.installArtifact(exe);

View file

@ -5,8 +5,8 @@
.dependencies = .{
.common = .{ .path = "../../lib/common-zig" },
.wayland = .{
.url = "git+https://git.mzte.de/LordMZTE/zig-wayland#1164c9eaa59442e6a8ec8e994fd5d30c23e4ed6d",
.hash = "122064a0e836c603b42720f101cd1b983f9b79f2457b58afdfa1aca1d7c406e80b83",
.url = "git+https://codeberg.org/ifreund/zig-wayland.git#092e3424345d9c0a9467771b2f629fa01560a69f",
.hash = "1220ab835f090bde18b74191e88c4ab3bd49364d310bd9912eccebd3c47bad7957a3",
},
},
}

View file

@ -137,7 +137,7 @@ pub fn getContent(self: *ClipboardConnection, out_fd: std.posix.fd_t) !void {
t: ?[:0]const u8 = null,
fn offerListener(_: *wl.DataOffer, event: wl.DataOffer.Event, mt: *@This()) void {
const text_types = std.ComptimeStringMap(void, .{
const text_types = std.StaticStringMap(void).initComptime(.{
.{ "TEXT", {} },
.{ "STRING", {} },
.{ "UTF8_STRING", {} },

View file

@ -60,7 +60,7 @@ pub fn main() !void {
std.log.info("invoking editor with command {s}", .{&editor_argv});
var nvide_child = std.ChildProcess.init(&editor_argv, alloc);
var nvide_child = std.process.Child.init(&editor_argv, alloc);
_ = try nvide_child.spawnAndWait();
const stat = std.fs.cwd().statFile(filename) catch |e| {

View file

@ -1 +0,0 @@
/zig-*

View file

@ -7,7 +7,7 @@ pub fn build(b: *std.Build) !void {
const exe = b.addExecutable(.{
.name = "withjava",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});

View file

@ -47,7 +47,7 @@ pub fn main() !u8 {
for (std.os.argv[2..], child_argv) |a1, *a2|
a2.* = std.mem.span(a1);
var child = std.ChildProcess.init(child_argv, alloc);
var child = std.process.Child.init(child_argv, alloc);
child.env_map = &env;
const term = try child.spawnAndWait();

View file

@ -1 +0,0 @@
/zig-*

View file

@ -7,13 +7,14 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const scanner = Scanner.create(b, .{});
const wayland_mod = scanner.mod;
const wayland_mod = b.createModule(.{ .root_source_file = scanner.result });
const exe = b.addExecutable(.{
.name = "wlbg",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
exe.root_module.addImport("common", b.dependency("common", .{}).module("common"));
@ -31,6 +32,8 @@ pub fn build(b: *std.Build) void {
scanner.generate("wl_seat", 8);
scanner.generate("wl_output", 4);
scanner.addCSource(exe);
exe.root_module.linkSystemLibrary("wayland-client", .{});
exe.root_module.linkSystemLibrary("wayland-egl", .{});
exe.root_module.linkSystemLibrary("EGL", .{});

View file

@ -5,8 +5,8 @@
.dependencies = .{
.common = .{ .path = "../../lib/common-zig" },
.wayland = .{
.url = "git+https://git.mzte.de/LordMZTE/zig-wayland#1164c9eaa59442e6a8ec8e994fd5d30c23e4ed6d",
.hash = "122064a0e836c603b42720f101cd1b983f9b79f2457b58afdfa1aca1d7c406e80b83",
.url = "git+https://codeberg.org/ifreund/zig-wayland.git#092e3424345d9c0a9467771b2f629fa01560a69f",
.hash = "1220ab835f090bde18b74191e88c4ab3bd49364d310bd9912eccebd3c47bad7957a3",
},
},
}

View file

@ -16,7 +16,6 @@
(install-link "scripts/videos-duration.sh" (bin-path "videos-duration"))
;; Compiled scripts
(install-zig "scripts/alecor")
(install-zig "scripts/hyprtool")
(install-rust "scripts/i3status")
(install-zig "scripts/mzteinit")