From 12aa7b6448c72697cfc50cb0b8e6db4e2665901d Mon Sep 17 00:00:00 2001 From: Squibid Date: Fri, 12 Dec 2025 17:42:51 -0500 Subject: [PATCH] make sure all callbacks send their errors to the remote lua clients --- src/types/Hook.zig | 2 +- src/types/Keymap.zig | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/types/Hook.zig b/src/types/Hook.zig index 48a8e37..364f29c 100644 --- a/src/types/Hook.zig +++ b/src/types/Hook.zig @@ -27,7 +27,7 @@ pub fn callback(self: *const Hook, args: anytype) void { const t = Lua.state.rawGetIndex(zlua.registry_index, self.options.lua_cb_ref_idx); if (t != zlua.LuaType.function) { - std.log.err("Failed to call hook, it doesn't have a callback.", .{}); + RemoteLua.sendNewLogEntry("Failed to call hook, it doesn't have a callback."); Lua.state.pop(1); return; } diff --git a/src/types/Keymap.zig b/src/types/Keymap.zig index 84e8877..57f4c74 100644 --- a/src/types/Keymap.zig +++ b/src/types/Keymap.zig @@ -8,6 +8,7 @@ const xkb = @import("xkbcommon"); const wlr = @import("wlroots"); const zlua = @import("zlua"); +const RemoteLua = @import("../RemoteLua.zig"); const Lua = &@import("../main.zig").lua; modifier: wlr.Keyboard.ModifierMask, @@ -25,13 +26,13 @@ pub fn callback(self: *const Keymap, release: bool) void { const t = Lua.state.rawGetIndex(zlua.registry_index, lua_ref_idx); if (t != zlua.LuaType.function) { - std.log.err("Failed to call keybind, it doesn't have a callback.", .{}); + RemoteLua.sendNewLogEntry("Failed to call keybind, it doesn't have a callback."); Lua.state.pop(1); return; } Lua.state.protectedCall(.{ .args = 0, .results = 0 }) catch { - // TODO: add a callback to remote lua when that gets merged + RemoteLua.sendNewLogEntry(Lua.state.toString(-1) catch unreachable); }; Lua.state.pop(-1); }