diff --git a/cg_opts.lua b/cg_opts.lua index 3485357..08a5c2f 100644 --- a/cg_opts.lua +++ b/cg_opts.lua @@ -1,7 +1,7 @@ local opts = {} 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 = "s", label = "shell", cmd = { "fish" } }, { key = "l", label = "logout", cmd = { "!quit" } }, diff --git a/confgen.lua b/confgen.lua index 28c3990..606249d 100644 --- a/confgen.lua +++ b/confgen.lua @@ -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 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 font-name \"" .. cg.opt.font .. " 11\"") + cg.opt.system('gsettings set org.gnome.desktop.interface font-name "' .. cg.opt.font .. ' 11"') end end) @@ -40,14 +40,6 @@ local function merge(a, b) return a 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. cg.opt.getDeviceConf = function(id) local path = os.getenv "HOME" .. "/.config/mzte_localconf/" .. id @@ -104,3 +96,11 @@ cg.opt.fileExists = function(path) return false 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 diff --git a/mzte-nv/src/compiler.zig b/mzte-nv/src/compiler.zig index da4767c..e2a6b20 100644 --- a/mzte-nv/src/compiler.zig +++ b/mzte-nv/src/compiler.zig @@ -5,8 +5,8 @@ const ser = @import("ser.zig"); const log = std.log.scoped(.compiler); -pub const std_options = struct { - pub const log_level = .debug; +pub const std_options = std.Options{ + .log_level = .debug, }; pub fn main() !void { diff --git a/mzte-nv/src/main.zig b/mzte-nv/src/main.zig index 83ee129..0cc7a75 100644 --- a/mzte-nv/src/main.zig +++ b/mzte-nv/src/main.zig @@ -19,47 +19,49 @@ const modules = struct { const utils = @import("modules/utils.zig"); }; -pub const std_options = struct { - pub fn logFn( - comptime level: std.log.Level, - comptime scope: @TypeOf(.EnumLiteral), - comptime format: []const u8, - args: anytype, - ) void { - var msg_buf: [512]u8 = undefined; - const msg = std.fmt.bufPrintZ(&msg_buf, format, args) catch return; +pub const std_options = std.Options{ + .logFn = struct { + pub fn logFn( + comptime level: std.log.Level, + comptime scope: @TypeOf(.EnumLiteral), + comptime format: []const u8, + args: anytype, + ) void { + var msg_buf: [512]u8 = undefined; + const msg = std.fmt.bufPrintZ(&msg_buf, format, args) catch return; - var title_buf: [512]u8 = undefined; - const title = std.fmt.bufPrintZ( - &title_buf, - "MZTE-NV ({s})", - .{@tagName(scope)}, - ) catch return; + var title_buf: [512]u8 = undefined; + const title = std.fmt.bufPrintZ( + &title_buf, + "MZTE-NV ({s})", + .{@tagName(scope)}, + ) catch return; - const lvl = switch (level) { - .debug => nvim.LOGLVL_DBG, - .info => nvim.LOGLVL_INF, - .warn => nvim.LOGLVL_WRN, - .err => nvim.LOGLVL_ERR, - }; + const lvl = switch (level) { + .debug => nvim.LOGLVL_DBG, + .info => nvim.LOGLVL_INF, + .warn => nvim.LOGLVL_WRN, + .err => nvim.LOGLVL_ERR, + }; - var dict = znvim.Dictionary{ .alloc = std.heap.c_allocator }; - defer dict.deinit(); + var dict = znvim.Dictionary{ .alloc = std.heap.c_allocator }; + defer dict.deinit(); - dict.push(@constCast("title"), znvim.nvimObject(@as([]u8, title))) catch return; - // noice notficitaions recognize this and show in the mini view instead of notifs - dict.push(@constCast("mzte_nv_mini"), comptime znvim.nvimObject(true)) catch return; + dict.push(@constCast("title"), znvim.nvimObject(@as([]u8, title))) catch return; + // noice notficitaions recognize this and show in the mini view instead of notifs + dict.push(@constCast("mzte_nv_mini"), comptime znvim.nvimObject(true)) catch return; - var e = znvim.Error{}; - _ = nvim.nvim_notify( - znvim.nvimString(msg), - lvl, - dict.dict, - &e.err, - ); - } + var e = znvim.Error{}; + _ = nvim.nvim_notify( + znvim.nvimString(msg), + lvl, + dict.dict, + &e.err, + ); + } + }.logFn, - pub const log_level = .debug; + .log_level = .debug, }; const reg_key = "mzte-nv-reg"; diff --git a/mzte-nv/src/modules/cpbuf.zig b/mzte-nv/src/modules/cpbuf.zig index fce8e54..0a35345 100644 --- a/mzte-nv/src/modules/cpbuf.zig +++ b/mzte-nv/src/modules/cpbuf.zig @@ -31,7 +31,7 @@ fn lCopyBuf(l: *c.lua_State) !c_int { const ft_opt = znvim.OptionValue.get("filetype", .local); - // store previous window layout + // store previous window layout const cursor_pos = nvim.curwin.*.w_cursor; const topline = nvim.curwin.*.w_topline; diff --git a/plugins/mzte-mpv/src/main.zig b/plugins/mzte-mpv/src/main.zig index 0d6b328..314fe7a 100644 --- a/plugins/mzte-mpv/src/main.zig +++ b/plugins/mzte-mpv/src/main.zig @@ -4,20 +4,22 @@ const c = ffi.c; const ffi = @import("ffi.zig"); const util = @import("util.zig"); -pub const std_options = struct { - pub const log_level = .debug; - pub fn logFn( - comptime message_level: std.log.Level, - comptime scope: @TypeOf(.enum_literal), - comptime format: []const u8, - args: anytype, - ) void { - _ = scope; +pub const std_options = std.Options{ + .log_level = .debug, + .logFn = struct { + fn logFn( + comptime message_level: std.log.Level, + comptime scope: @TypeOf(.enum_literal), + comptime format: []const u8, + args: anytype, + ) void { + _ = scope; - const stderr = std.io.getStdErr().writer(); + const stderr = std.io.getStdErr().writer(); - 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 { diff --git a/plugins/mzte-mpv/src/util.zig b/plugins/mzte-mpv/src/util.zig index 733ba60..066ce63 100644 --- a/plugins/mzte-mpv/src/util.zig +++ b/plugins/mzte-mpv/src/util.zig @@ -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" }), )); } - diff --git a/scripts/alecor/src/main.zig b/scripts/alecor/src/main.zig index 8af58eb..b14e1d9 100644 --- a/scripts/alecor/src/main.zig +++ b/scripts/alecor/src/main.zig @@ -3,8 +3,8 @@ const std = @import("std"); const cache = @import("cache.zig"); const util = @import("util.zig"); -pub const std_options = struct { - pub const log_level = .debug; +pub const std_options = std.Options{ + .log_level = .debug, }; pub fn main() !void { diff --git a/scripts/hyprtool/src/main.zig b/scripts/hyprtool/src/main.zig index 96629cb..2365b82 100644 --- a/scripts/hyprtool/src/main.zig +++ b/scripts/hyprtool/src/main.zig @@ -1,7 +1,7 @@ const std = @import("std"); -pub const std_options = struct { - pub const log_level = .debug; +pub const std_options = std.Options{ + .log_level = .debug, }; pub fn main() !void { diff --git a/scripts/mzteinit/src/main.zig b/scripts/mzteinit/src/main.zig index 929fbe8..68dfbca 100644 --- a/scripts/mzteinit/src/main.zig +++ b/scripts/mzteinit/src/main.zig @@ -9,29 +9,31 @@ const Server = @import("sock/Server.zig"); const msg = @import("message.zig").msg; -pub const std_options = struct { - pub const log_level = .debug; - pub fn logFn( - comptime msg_level: std.log.Level, - comptime scope: @TypeOf(.enum_literal), - comptime fmt: []const u8, - args: anytype, - ) void { - const logfile = log_file orelse return; +pub const std_options = std.Options{ + .log_level = .debug, + .logFn = struct { + pub fn logFn( + comptime msg_level: std.log.Level, + comptime scope: @TypeOf(.enum_literal), + comptime fmt: []const u8, + args: anytype, + ) void { + const logfile = log_file orelse return; - if (scope != .default) { - logfile.writer().print("[{s}] ", .{@tagName(scope)}) catch return; + if (scope != .default) { + logfile.writer().print("[{s}] ", .{@tagName(scope)}) catch return; + } + + logfile.writer().writeAll(switch (msg_level) { + .err => "E: ", + .warn => "W: ", + .info => "I: ", + .debug => "D: ", + }) catch return; + + logfile.writer().print(fmt ++ "\n", args) catch return; } - - logfile.writer().writeAll(switch (msg_level) { - .err => "E: ", - .warn => "W: ", - .info => "I: ", - .debug => "D: ", - }) catch return; - - logfile.writer().print(fmt ++ "\n", args) catch return; - } + }.logFn, }; var log_file: ?std.fs.File = null; diff --git a/scripts/mzteinit/src/mzteinitctl.zig b/scripts/mzteinit/src/mzteinitctl.zig index e2d053c..b4c5f62 100644 --- a/scripts/mzteinit/src/mzteinitctl.zig +++ b/scripts/mzteinit/src/mzteinitctl.zig @@ -2,8 +2,8 @@ const std = @import("std"); const Client = @import("sock/Client.zig"); -pub const std_options = struct { - pub const log_level = .debug; +pub const std_options = std.Options{ + .log_level = .debug, }; pub fn main() !void { diff --git a/scripts/mzteriver/build.zig b/scripts/mzteriver/build.zig index bf4bee9..6c89cff 100644 --- a/scripts/mzteriver/build.zig +++ b/scripts/mzteriver/build.zig @@ -7,18 +7,13 @@ pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); - const cg_opt = try common.confgenGet(struct { - nvidia: bool = false, - term: struct { command: [:0]const u8 }, - commands: struct { - file_manager: [:0]const u8, - browser: [:0]const u8, - }, - cursor: struct { - theme: [:0]const u8, - size: u32, - } - }, "../..", b.allocator); + const cg_opt = try common.confgenGet(struct { nvidia: bool = false, term: struct { command: [:0]const u8 }, commands: struct { + file_manager: [:0]const u8, + browser: [:0]const u8, + }, cursor: struct { + theme: [:0]const u8, + size: u32, + } }, "../..", b.allocator); const opts = b.addOptions(); opts.addOption(bool, "nvidia", cg_opt.nvidia); diff --git a/scripts/mzteriver/src/init.zig b/scripts/mzteriver/src/init.zig index e649c48..a741ade 100644 --- a/scripts/mzteriver/src/init.zig +++ b/scripts/mzteriver/src/init.zig @@ -137,13 +137,18 @@ pub fn init(alloc: std.mem.Allocator) !void { try con.runCommand(&.{ "border-color-focused", "0x880000" }); try con.runCommand(&.{ "border-color-unfocused", "0x660000" }); + try con.runCommand(&.{ "hide-cursor", "when-typing", "enabled" }); + try con.runCommand(&.{ "xcursor-theme", opts.cursor_theme, 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" }); @@ -177,7 +182,7 @@ pub fn init(alloc: std.mem.Allocator) !void { inline for (.{ .{"wlbg"}, .{"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" }, .{ "rivertile", "-view-padding", "6", "-outer-padding", "6" }, }) |argv| { diff --git a/scripts/mzteriver/src/main.zig b/scripts/mzteriver/src/main.zig index d4577f0..6bf2297 100644 --- a/scripts/mzteriver/src/main.zig +++ b/scripts/mzteriver/src/main.zig @@ -1,11 +1,11 @@ const std = @import("std"); const opts = @import("opts"); -pub const std_options = struct { - pub const log_level = switch (@import("builtin").mode) { +pub const std_options = std.Options{ + .log_level = switch (@import("builtin").mode) { .Debug => .debug, else => .info, - }; + }, }; pub fn main() !void { diff --git a/scripts/openbrowser/src/main.zig b/scripts/openbrowser/src/main.zig index e5a0ec6..8478b51 100644 --- a/scripts/openbrowser/src/main.zig +++ b/scripts/openbrowser/src/main.zig @@ -1,8 +1,8 @@ const std = @import("std"); const info = @import("info.zig"); -pub const std_options = struct { - pub const log_level = .debug; +pub const std_options = std.Options{ + .log_level = .debug, }; const browsers = &[_][]const u8{ diff --git a/scripts/playtwitch/src/main.zig b/scripts/playtwitch/src/main.zig index bb737f3..0461e33 100644 --- a/scripts/playtwitch/src/main.zig +++ b/scripts/playtwitch/src/main.zig @@ -4,8 +4,8 @@ const gui = @import("gui.zig"); const State = @import("State.zig"); const log = std.log.scoped(.main); -pub const std_options = struct { - pub const log_level = .debug; +pub const std_options = std.Options{ + .log_level = .debug, }; pub fn main() !void { diff --git a/scripts/prompt/build.zig.zon b/scripts/prompt/build.zig.zon index 0fc62dd..9604631 100644 --- a/scripts/prompt/build.zig.zon +++ b/scripts/prompt/build.zig.zon @@ -8,8 +8,8 @@ .hash = "1220ea86ace34b38e49c1d737c5f857d88346af10695a992b38e10cb0a73b6a19ef7", }, .known_folders = .{ - .url = "git+https://github.com/ziglibs/known-folders#806ba01b872820004c7dec3117cb0db66b206af6", - .hash = "122094b48dea08e241b48d0ec32e3df6965e814091e3cabaff942e62d053f3ff9b5f", + .url = "git+https://github.com/ziglibs/known-folders.git#2aa7f2e9855d45b20072e15107fb379b9380adbe", + .hash = "12209925016f4b5486a713828ead3bcc900fa4f039c93de1894aa7d5253f7633b92c", }, }, .paths = .{""}, diff --git a/scripts/randomwallpaper/src/main.zig b/scripts/randomwallpaper/src/main.zig index 9f2b555..a60571c 100644 --- a/scripts/randomwallpaper/src/main.zig +++ b/scripts/randomwallpaper/src/main.zig @@ -2,8 +2,8 @@ const std = @import("std"); const xinerama = @import("xinerama.zig"); const Walker = @import("Walker.zig"); -pub const std_options = struct { - pub const log_level = .debug; +pub const std_options = std.Options{ + .log_level = .debug, }; pub fn main() !u8 { diff --git a/scripts/vinput/src/main.zig b/scripts/vinput/src/main.zig index ee87524..23c7b3f 100644 --- a/scripts/vinput/src/main.zig +++ b/scripts/vinput/src/main.zig @@ -2,8 +2,8 @@ const std = @import("std"); const c = @import("ffi.zig").c; const ClipboardConnection = @import("ClipboardConnection.zig"); -pub const std_options = struct { - pub const log_level = .debug; +pub const std_options = std.Options{ + .log_level = .debug, }; pub fn main() !void { diff --git a/scripts/wlbg/src/main.zig b/scripts/wlbg/src/main.zig index bdd896b..091281f 100644 --- a/scripts/wlbg/src/main.zig +++ b/scripts/wlbg/src/main.zig @@ -16,8 +16,8 @@ const wl = wayland.client.wl; const zwlr = wayland.client.zwlr; const zxdg = wayland.client.zxdg; -pub const std_options = struct { - pub const log_level = .debug; +pub const std_options = std.Options{ + .log_level = .debug, }; pub fn main() !void {