update to latest Zig

+ other random fixes
This commit is contained in:
LordMZTE 2024-02-11 13:10:53 +01:00
parent d151dcde48
commit d914aa4069
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
20 changed files with 122 additions and 117 deletions

View file

@ -1,7 +1,7 @@
local opts = {} local opts = {}
opts.mzteinit_entries = { opts.mzteinit_entries = {
{ key = "r", label = "river", cmd = { "mzteriver" } }, { key = "r", label = "river", cmd = { cg.opt.system "which mzteriver" } },
{ key = "h", label = "hyprland", cmd = { "Hyprland" } }, { key = "h", label = "hyprland", cmd = { "Hyprland" } },
{ key = "s", label = "shell", cmd = { "fish" } }, { key = "s", label = "shell", cmd = { "fish" } },
{ key = "l", label = "logout", cmd = { "!quit" } }, { key = "l", label = "logout", cmd = { "!quit" } },

View file

@ -18,7 +18,7 @@ cg.onDone(function(errors)
cg.opt.system("gsettings set org.gnome.desktop.interface gtk-theme " .. cg.opt.gtk_theme) cg.opt.system("gsettings set org.gnome.desktop.interface gtk-theme " .. cg.opt.gtk_theme)
cg.opt.system("gsettings set org.gnome.desktop.interface cursor-theme " .. cg.opt.cursor.theme) cg.opt.system("gsettings set org.gnome.desktop.interface cursor-theme " .. cg.opt.cursor.theme)
cg.opt.system("gsettings set org.gnome.desktop.interface cursor-size " .. cg.opt.cursor.size) cg.opt.system("gsettings set org.gnome.desktop.interface cursor-size " .. cg.opt.cursor.size)
cg.opt.system("gsettings set org.gnome.desktop.interface font-name \"" .. cg.opt.font .. " 11\"") cg.opt.system('gsettings set org.gnome.desktop.interface font-name "' .. cg.opt.font .. ' 11"')
end end
end) end)
@ -40,14 +40,6 @@ local function merge(a, b)
return a return a
end end
cg.opt = merge(cg.opt, require "cg_opts")
local local_opts = loadfile(os.getenv "HOME" .. "/.config/mzte_localconf/opts.lua")
if local_opts then
cg.opt = merge(cg.opt, local_opts())
end
-- This function is called in templates to allow adding device-specific configs. -- This function is called in templates to allow adding device-specific configs.
cg.opt.getDeviceConf = function(id) cg.opt.getDeviceConf = function(id)
local path = os.getenv "HOME" .. "/.config/mzte_localconf/" .. id local path = os.getenv "HOME" .. "/.config/mzte_localconf/" .. id
@ -104,3 +96,11 @@ cg.opt.fileExists = function(path)
return false return false
end end
cg.opt = merge(cg.opt, require "cg_opts")
local local_opts = loadfile(os.getenv "HOME" .. "/.config/mzte_localconf/opts.lua")
if local_opts then
cg.opt = merge(cg.opt, local_opts())
end

View file

@ -5,8 +5,8 @@ const ser = @import("ser.zig");
const log = std.log.scoped(.compiler); const log = std.log.scoped(.compiler);
pub const std_options = struct { pub const std_options = std.Options{
pub const log_level = .debug; .log_level = .debug,
}; };
pub fn main() !void { pub fn main() !void {

View file

@ -19,7 +19,8 @@ const modules = struct {
const utils = @import("modules/utils.zig"); const utils = @import("modules/utils.zig");
}; };
pub const std_options = struct { pub const std_options = std.Options{
.logFn = struct {
pub fn logFn( pub fn logFn(
comptime level: std.log.Level, comptime level: std.log.Level,
comptime scope: @TypeOf(.EnumLiteral), comptime scope: @TypeOf(.EnumLiteral),
@ -58,8 +59,9 @@ pub const std_options = struct {
&e.err, &e.err,
); );
} }
}.logFn,
pub const log_level = .debug; .log_level = .debug,
}; };
const reg_key = "mzte-nv-reg"; const reg_key = "mzte-nv-reg";

View file

@ -4,9 +4,10 @@ const c = ffi.c;
const ffi = @import("ffi.zig"); const ffi = @import("ffi.zig");
const util = @import("util.zig"); const util = @import("util.zig");
pub const std_options = struct { pub const std_options = std.Options{
pub const log_level = .debug; .log_level = .debug,
pub fn logFn( .logFn = struct {
fn logFn(
comptime message_level: std.log.Level, comptime message_level: std.log.Level,
comptime scope: @TypeOf(.enum_literal), comptime scope: @TypeOf(.enum_literal),
comptime format: []const u8, comptime format: []const u8,
@ -18,6 +19,7 @@ pub const std_options = struct {
stderr.print("[mzte-mpv {s}] " ++ format ++ "\n", .{@tagName(message_level)} ++ args) catch return; stderr.print("[mzte-mpv {s}] " ++ format ++ "\n", .{@tagName(message_level)} ++ args) catch return;
} }
}.logFn,
}; };
export fn mpv_open_cplugin(handle: *c.mpv_handle) callconv(.C) c_int { export fn mpv_open_cplugin(handle: *c.mpv_handle) callconv(.C) c_int {

View file

@ -13,4 +13,3 @@ pub fn msg(mpv: *c.mpv_handle, comptime fmt: []const u8, args: anytype) !void {
@constCast(&[_:null]?[*:0]const u8{ "show-text", osd_msg, "4000" }), @constCast(&[_:null]?[*:0]const u8{ "show-text", osd_msg, "4000" }),
)); ));
} }

View file

@ -3,8 +3,8 @@ const std = @import("std");
const cache = @import("cache.zig"); const cache = @import("cache.zig");
const util = @import("util.zig"); const util = @import("util.zig");
pub const std_options = struct { pub const std_options = std.Options{
pub const log_level = .debug; .log_level = .debug,
}; };
pub fn main() !void { pub fn main() !void {

View file

@ -1,7 +1,7 @@
const std = @import("std"); const std = @import("std");
pub const std_options = struct { pub const std_options = std.Options{
pub const log_level = .debug; .log_level = .debug,
}; };
pub fn main() !void { pub fn main() !void {

View file

@ -9,8 +9,9 @@ const Server = @import("sock/Server.zig");
const msg = @import("message.zig").msg; const msg = @import("message.zig").msg;
pub const std_options = struct { pub const std_options = std.Options{
pub const log_level = .debug; .log_level = .debug,
.logFn = struct {
pub fn logFn( pub fn logFn(
comptime msg_level: std.log.Level, comptime msg_level: std.log.Level,
comptime scope: @TypeOf(.enum_literal), comptime scope: @TypeOf(.enum_literal),
@ -32,6 +33,7 @@ pub const std_options = struct {
logfile.writer().print(fmt ++ "\n", args) catch return; logfile.writer().print(fmt ++ "\n", args) catch return;
} }
}.logFn,
}; };
var log_file: ?std.fs.File = null; var log_file: ?std.fs.File = null;

View file

@ -2,8 +2,8 @@ const std = @import("std");
const Client = @import("sock/Client.zig"); const Client = @import("sock/Client.zig");
pub const std_options = struct { pub const std_options = std.Options{
pub const log_level = .debug; .log_level = .debug,
}; };
pub fn main() !void { pub fn main() !void {

View file

@ -7,18 +7,13 @@ pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
const cg_opt = try common.confgenGet(struct { const cg_opt = try common.confgenGet(struct { nvidia: bool = false, term: struct { command: [:0]const u8 }, commands: struct {
nvidia: bool = false,
term: struct { command: [:0]const u8 },
commands: struct {
file_manager: [:0]const u8, file_manager: [:0]const u8,
browser: [:0]const u8, browser: [:0]const u8,
}, }, cursor: struct {
cursor: struct {
theme: [:0]const u8, theme: [:0]const u8,
size: u32, size: u32,
} } }, "../..", b.allocator);
}, "../..", b.allocator);
const opts = b.addOptions(); const opts = b.addOptions();
opts.addOption(bool, "nvidia", cg_opt.nvidia); opts.addOption(bool, "nvidia", cg_opt.nvidia);

View file

@ -137,13 +137,18 @@ pub fn init(alloc: std.mem.Allocator) !void {
try con.runCommand(&.{ "border-color-focused", "0x880000" }); try con.runCommand(&.{ "border-color-focused", "0x880000" });
try con.runCommand(&.{ "border-color-unfocused", "0x660000" }); try con.runCommand(&.{ "border-color-unfocused", "0x660000" });
try con.runCommand(&.{ "hide-cursor", "when-typing", "enabled" });
try con.runCommand(&.{ try con.runCommand(&.{
"xcursor-theme", "xcursor-theme",
opts.cursor_theme, opts.cursor_theme,
std.fmt.comptimePrint("{}", .{opts.cursor_size}), std.fmt.comptimePrint("{}", .{opts.cursor_size}),
}); });
try con.runCommand(&.{ "float-filter-add", "app-id", "vinput-editor" }); try con.runCommand(&.{ "rule-add", "-app-id", "vinput-editor", "float" });
// disable client-side decoration (completely stupid concept)
try con.runCommand(&.{ "rule-add", "-app-id", "*", "ssd" });
try con.runCommand(&.{ "default-layout", "rivertile" }); try con.runCommand(&.{ "default-layout", "rivertile" });
@ -177,7 +182,7 @@ pub fn init(alloc: std.mem.Allocator) !void {
inline for (.{ inline for (.{
.{"wlbg"}, .{"wlbg"},
.{"waybar"}, .{"waybar"},
.{ "dbus-update-activation-environment", "DISPLAY", "XAUTHORITY", "WAYLAND_DISPLAY" }, .{ "dbus-update-activation-environment", "DISPLAY", "XAUTHORITY", "WAYLAND_DISPLAY", "XDG_CURRENT_DESKTOP" },
.{ "systemctl", "--user", "import-environment", "DISPLAY", "XAUTHORITY", "WAYLAND_DISPLAY", "XDG_CURRENT_DESKTOP" }, .{ "systemctl", "--user", "import-environment", "DISPLAY", "XAUTHORITY", "WAYLAND_DISPLAY", "XDG_CURRENT_DESKTOP" },
.{ "rivertile", "-view-padding", "6", "-outer-padding", "6" }, .{ "rivertile", "-view-padding", "6", "-outer-padding", "6" },
}) |argv| { }) |argv| {

View file

@ -1,11 +1,11 @@
const std = @import("std"); const std = @import("std");
const opts = @import("opts"); const opts = @import("opts");
pub const std_options = struct { pub const std_options = std.Options{
pub const log_level = switch (@import("builtin").mode) { .log_level = switch (@import("builtin").mode) {
.Debug => .debug, .Debug => .debug,
else => .info, else => .info,
}; },
}; };
pub fn main() !void { pub fn main() !void {

View file

@ -1,8 +1,8 @@
const std = @import("std"); const std = @import("std");
const info = @import("info.zig"); const info = @import("info.zig");
pub const std_options = struct { pub const std_options = std.Options{
pub const log_level = .debug; .log_level = .debug,
}; };
const browsers = &[_][]const u8{ const browsers = &[_][]const u8{

View file

@ -4,8 +4,8 @@ const gui = @import("gui.zig");
const State = @import("State.zig"); const State = @import("State.zig");
const log = std.log.scoped(.main); const log = std.log.scoped(.main);
pub const std_options = struct { pub const std_options = std.Options{
pub const log_level = .debug; .log_level = .debug,
}; };
pub fn main() !void { pub fn main() !void {

View file

@ -8,8 +8,8 @@
.hash = "1220ea86ace34b38e49c1d737c5f857d88346af10695a992b38e10cb0a73b6a19ef7", .hash = "1220ea86ace34b38e49c1d737c5f857d88346af10695a992b38e10cb0a73b6a19ef7",
}, },
.known_folders = .{ .known_folders = .{
.url = "git+https://github.com/ziglibs/known-folders#806ba01b872820004c7dec3117cb0db66b206af6", .url = "git+https://github.com/ziglibs/known-folders.git#2aa7f2e9855d45b20072e15107fb379b9380adbe",
.hash = "122094b48dea08e241b48d0ec32e3df6965e814091e3cabaff942e62d053f3ff9b5f", .hash = "12209925016f4b5486a713828ead3bcc900fa4f039c93de1894aa7d5253f7633b92c",
}, },
}, },
.paths = .{""}, .paths = .{""},

View file

@ -2,8 +2,8 @@ const std = @import("std");
const xinerama = @import("xinerama.zig"); const xinerama = @import("xinerama.zig");
const Walker = @import("Walker.zig"); const Walker = @import("Walker.zig");
pub const std_options = struct { pub const std_options = std.Options{
pub const log_level = .debug; .log_level = .debug,
}; };
pub fn main() !u8 { pub fn main() !u8 {

View file

@ -2,8 +2,8 @@ const std = @import("std");
const c = @import("ffi.zig").c; const c = @import("ffi.zig").c;
const ClipboardConnection = @import("ClipboardConnection.zig"); const ClipboardConnection = @import("ClipboardConnection.zig");
pub const std_options = struct { pub const std_options = std.Options{
pub const log_level = .debug; .log_level = .debug,
}; };
pub fn main() !void { pub fn main() !void {

View file

@ -16,8 +16,8 @@ const wl = wayland.client.wl;
const zwlr = wayland.client.zwlr; const zwlr = wayland.client.zwlr;
const zxdg = wayland.client.zxdg; const zxdg = wayland.client.zxdg;
pub const std_options = struct { pub const std_options = std.Options{
pub const log_level = .debug; .log_level = .debug,
}; };
pub fn main() !void { pub fn main() !void {