From c70ddf74dcd79eb59f8bfb8614a46ad3e8df0a1c Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Tue, 9 Jul 2024 18:24:01 +0200 Subject: [PATCH] mzteinit refactors --- scripts/mzteinit/build.zig | 13 ++++++++++++- scripts/mzteinit/src/env.zig | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/mzteinit/build.zig b/scripts/mzteinit/build.zig index 1695a40..05d3b03 100644 --- a/scripts/mzteinit/build.zig +++ b/scripts/mzteinit/build.zig @@ -27,12 +27,23 @@ pub fn build(b: *std.Build) !void { e.root_module.addImport("common", common_mod); } + // TODO: Broken, see: https://github.com/ziglang/zig/issues/20525 + //const cg_opt = try common.confgenGet(struct { + // gtk_theme: []const u8, + // mzteinit_entries: []const struct { + // key: []const u8, + // label: []const u8, + // cmd: []const []const u8, + // quit: bool = false, + // }, + //}, b.allocator); + const cg_opt = try common.confgenGet(struct { gtk_theme: []const u8, }, b.allocator); const opts = b.addOptions(); - opts.addOption([]const u8, "gtk_theme", cg_opt.gtk_theme); + opts.addOption(@TypeOf(cg_opt), "cg", cg_opt); exe.root_module.addImport("opts", opts.createModule()); b.installArtifact(exe); diff --git a/scripts/mzteinit/src/env.zig b/scripts/mzteinit/src/env.zig index 4d3e2bf..6358853 100644 --- a/scripts/mzteinit/src/env.zig +++ b/scripts/mzteinit/src/env.zig @@ -1,4 +1,6 @@ const std = @import("std"); +const cg = @import("opts").cg; + const sysdaemon = @import("sysdaemon.zig"); const util = @import("util.zig"); @@ -156,7 +158,7 @@ pub fn populateEnvironment(env: *std.process.EnvMap) !bool { // GUI options { try env.put("QT_QPA_PLATFORMTHEME", "qt5ct"); - try env.put("GTK_THEME", @import("opts").gtk_theme); // gtk theme from confgen + try env.put("GTK_THEME", cg.gtk_theme); // gtk theme from confgen // this stops GTK from dbus-launching the mid-bogglingly pointless at-spi daemon try env.put("NO_AT_BRIDGE", "1");