xonecas.io
79113
Ma

mini-coding-agent / commit 0b71c6d

feat: use kitty protocol to show images when cofigured

xonecas2026-10-16 0b71c6d0f3f0777f9625524d55e34f12f6c41a2d parent c11dbeb

7 files changed

README.md+2−0
@@ -104,6 +104,7 @@ A full example:
104104 "model": "deepseek-v4.1-flash",
105105 "thinkingEffort": "medium",
106106 "theme": "tokyonight",
107+ "showImages": false,
107108 "systemPrompt": "Be terse.",
108109 "sessionsDir": "/home/me/.local/state/mini-coding-agent/sessions",
109110 "discoverAgentFiles": true,
@@ -153,6 +154,7 @@ Keys:
153154 | `model` | unset | model id |
154155 | `thinkingEffort` | unset | one of `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`; unset sends no reasoning parameter and clamps to what the model accepts |
155156 | `theme` | `tokyonight` | TUI palette: `tokyonight`, `oxocarbon`, or `kanagawa`. Read at startup; there is no live reload |
157+| `showImages` | `false` | display PNGs the `read` tool returns inline using the kitty graphics protocol; requires kitty 0.28+ |
156158 | `systemPrompt` | `""` | prepended to the system prompt |
157159 | `sessionsDir` | `$XDG_STATE_HOME/mini-coding-agent/sessions`, else `$HOME/.local/state/mini-coding-agent/sessions`, else `sessions` | where JSONL session logs go |
158160 | `discoverAgentFiles` | `true` | load `AGENTS.md`/`CLAUDE.md` from `$HOME/.agents` and the cwd |
src/agent.zig+2−1
@@ -18,7 +18,7 @@ pub const Event = union(enum) {
1818 tool_args: usize,
1919 tool_call: struct { name: []const u8, arguments: []const u8 },
2020 tool_output: []const u8,
21- tool_result: struct { name: []const u8, text: []const u8, is_error: bool, diffs: []const tools.FileDiff, body: ?[]const u8 },
21+ tool_result: struct { name: []const u8, text: []const u8, is_error: bool, diffs: []const tools.FileDiff, body: ?[]const u8, images: []const message_mod.ImageContent },
2222 message: *message_mod.AssistantMessage,
2323 no_model,
2424 err: []const u8,
@@ -290,6 +290,7 @@ pub fn runTurn(opts: Options, messages: *std.ArrayList(message_mod.Message), int
290290 .is_error = tool_message.tool_result.is_error,
291291 .diffs = if (result) |r| r.diffs else &.{},
292292 .body = if (result) |r| r.body else null,
293+ .images = if (result) |r| r.images else &.{},
293294 } });
294295 }
295296 if (!run_tools) {
src/config.zig+4−0
@@ -49,6 +49,7 @@ pub const Config = struct {
4949 thinking_effort: ?[]const u8,
5050 theme: []const u8,
5151 program_status: bool,
52+ show_images: bool,
5253 custom_providers: []const CustomProvider,
5354 mcp_servers: std.json.ArrayHashMap(McpServer),
5455 snapshot_ignore_dirs: []const []const u8,
@@ -72,6 +73,7 @@ const File = struct {
7273 mcpServers: ?std.json.ArrayHashMap(McpServer) = null,
7374 theme: ?[]const u8 = null,
7475 programStatus: ?bool = null,
76+ showImages: ?bool = null,
7577 snapshotIgnoreDirs: ?[]const []const u8 = null,
7678 snapshotUsesGitignore: ?bool = null,
7779 };
@@ -150,6 +152,7 @@ fn readInto(a: std.mem.Allocator, path: []const u8, required: bool, cfg: *Config
150152 if (file.thinkingEffort) |v| cfg.thinking_effort = v;
151153 if (file.theme) |v| cfg.theme = v;
152154 if (file.programStatus) |v| cfg.program_status = v;
155+ if (file.showImages) |v| cfg.show_images = v;
153156 if (file.snapshotIgnoreDirs) |v| cfg.snapshot_ignore_dirs = v;
154157 if (file.snapshotUsesGitignore) |v| cfg.snapshot_uses_gitignore = v;
155158 if (file.historySize) |v| cfg.history_size = v;
@@ -201,6 +204,7 @@ fn defaults(a: std.mem.Allocator) !Config {
201204 .thinking_effort = null,
202205 .theme = "tokyonight",
203206 .program_status = false,
207+ .show_images = false,
204208 .custom_providers = &.{},
205209 .mcp_servers = .{},
206210 .snapshot_ignore_dirs = &.{},
src/tui/image.zig+144−0
@@ -0,0 +1,144 @@
1+const std = @import("std");
2+const message_mod = @import("../message.zig");
3+
4+const placeholder_cp: u21 = 0x10EEEE;
5+const chunk_size = 4096;
6+const header_b64_bytes = 32;
7+const header_bytes = 24;
8+const max_placeholder_rows = 255;
9+const placeholder_id_mask = 0xFF_FFFF;
10+
11+/// Kitty row/column diacritics, indexed by value (rowcolumn-diacritics.txt).
12+const diacritics = [_]u21{
13+ 0x0305, 0x030D, 0x030E, 0x0310, 0x0312, 0x033D, 0x033E, 0x033F,
14+ 0x0346, 0x034A, 0x034B, 0x034C, 0x0350, 0x0351, 0x0352, 0x0357,
15+ 0x035B, 0x0363, 0x0364, 0x0365, 0x0366, 0x0367, 0x0368, 0x0369,
16+ 0x036A, 0x036B, 0x036C, 0x036D, 0x036E, 0x036F, 0x0483, 0x0484,
17+ 0x0485, 0x0486, 0x0487, 0x0592, 0x0593, 0x0594, 0x0595, 0x0597,
18+ 0x0598, 0x0599, 0x059C, 0x059D, 0x059E, 0x059F, 0x05A0, 0x05A1,
19+ 0x05A8, 0x05A9, 0x05AB, 0x05AC, 0x05AF, 0x05C4, 0x0610, 0x0611,
20+ 0x0612, 0x0613, 0x0614, 0x0615, 0x0616, 0x0617, 0x0657, 0x0658,
21+ 0x0659, 0x065A, 0x065B, 0x065D, 0x065E, 0x06D6, 0x06D7, 0x06D8,
22+ 0x06D9, 0x06DA, 0x06DB, 0x06DC, 0x06DF, 0x06E0, 0x06E1, 0x06E2,
23+ 0x06E4, 0x06E7, 0x06E8, 0x06EB, 0x06EC, 0x0730, 0x0732, 0x0733,
24+ 0x0735, 0x0736, 0x073A, 0x073D, 0x073F, 0x0740, 0x0741, 0x0743,
25+ 0x0745, 0x0747, 0x0749, 0x074A, 0x07EB, 0x07EC, 0x07ED, 0x07EE,
26+ 0x07EF, 0x07F0, 0x07F1, 0x07F3, 0x0816, 0x0817, 0x0818, 0x0819,
27+ 0x081B, 0x081C, 0x081D, 0x081E, 0x081F, 0x0820, 0x0821, 0x0822,
28+ 0x0823, 0x0825, 0x0826, 0x0827, 0x0829, 0x082A, 0x082B, 0x082C,
29+ 0x082D, 0x0951, 0x0953, 0x0954, 0x0F82, 0x0F83, 0x0F86, 0x0F87,
30+ 0x135D, 0x135E, 0x135F, 0x17DD, 0x193A, 0x1A17, 0x1A75, 0x1A76,
31+ 0x1A77, 0x1A78, 0x1A79, 0x1A7A, 0x1A7B, 0x1A7C, 0x1B6B, 0x1B6D,
32+ 0x1B6E, 0x1B6F, 0x1B70, 0x1B71, 0x1B72, 0x1B73, 0x1CD0, 0x1CD1,
33+ 0x1CD2, 0x1CDA, 0x1CDB, 0x1CE0, 0x1DC0, 0x1DC1, 0x1DC3, 0x1DC4,
34+ 0x1DC5, 0x1DC6, 0x1DC7, 0x1DC8, 0x1DC9, 0x1DCB, 0x1DCC, 0x1DD1,
35+ 0x1DD2, 0x1DD3, 0x1DD4, 0x1DD5, 0x1DD6, 0x1DD7, 0x1DD8, 0x1DD9,
36+ 0x1DDA, 0x1DDB, 0x1DDC, 0x1DDD, 0x1DDE, 0x1DDF, 0x1DE0, 0x1DE1,
37+ 0x1DE2, 0x1DE3, 0x1DE4, 0x1DE5, 0x1DE6, 0x1DFE, 0x20D0, 0x20D1,
38+ 0x20D4, 0x20D5, 0x20D6, 0x20D7, 0x20DB, 0x20DC, 0x20E1, 0x20E7,
39+ 0x20E9, 0x20F0, 0x2CEF, 0x2CF0, 0x2CF1, 0x2DE0, 0x2DE1, 0x2DE2,
40+ 0x2DE3, 0x2DE4, 0x2DE5, 0x2DE6, 0x2DE7, 0x2DE8, 0x2DE9, 0x2DEA,
41+ 0x2DEB, 0x2DEC, 0x2DED, 0x2DEE, 0x2DEF, 0x2DF0, 0x2DF1, 0x2DF2,
42+ 0x2DF3, 0x2DF4, 0x2DF5, 0x2DF6, 0x2DF7, 0x2DF8, 0x2DF9, 0x2DFA,
43+ 0x2DFB, 0x2DFC, 0x2DFD, 0x2DFE, 0x2DFF, 0xA66F, 0xA67C, 0xA67D,
44+ 0xA6F0, 0xA6F1, 0xA8E0, 0xA8E1, 0xA8E2, 0xA8E3, 0xA8E4, 0xA8E5,
45+};
46+
47+fn be32(b: []const u8) u32 {
48+ return (@as(u32, b[0]) << 24) | (@as(u32, b[1]) << 16) | (@as(u32, b[2]) << 8) | b[3];
49+}
50+
51+/// Width and height from the PNG IHDR chunk, decoding only the header.
52+fn pngSize(data: []const u8) ?struct { w: u32, h: u32 } {
53+ if (data.len < header_b64_bytes) return null;
54+ var head: [header_bytes]u8 = undefined;
55+ std.base64.standard.Decoder.decode(&head, data[0..header_b64_bytes]) catch return null;
56+ if (!std.mem.eql(u8, head[0..8], "\x89PNG\r\n\x1a\n")) return null;
57+ if (!std.mem.eql(u8, head[12..16], "IHDR")) return null;
58+ const w = be32(head[16..20]);
59+ const h = be32(head[20..24]);
60+ if (w == 0 or h == 0) return null;
61+ return .{ .w = w, .h = h };
62+}
63+
64+/// A stable, unique-enough image id whose low 24 bits address the placeholder
65+/// foreground color. `salt` varies per commit, `seq` per image.
66+pub fn imageId(salt: u8, seq: u32) u32 {
67+ return (@as(u32, salt) << 16) | (seq & 0xFFFF);
68+}
69+
70+fn writeCp(w: *std.Io.Writer, cp: u21) !void {
71+ var buf: [4]u8 = undefined;
72+ const n = std.unicode.utf8Encode(cp, &buf) catch unreachable;
73+ try w.writeAll(buf[0..n]);
74+}
75+
76+/// Transmit the base64 PNG payload to the terminal in `chunk_size` byte chunks.
77+/// `chunk_size` is a multiple of 4 so every chunk is valid base64.
78+fn transmit(w: *std.Io.Writer, id: u32, data: []const u8) !void {
79+ var off: usize = 0;
80+ var first = true;
81+ while (off < data.len) {
82+ const end = @min(off + chunk_size, data.len);
83+ const more = end < data.len;
84+ if (first) {
85+ try w.print("\x1b_Ga=t,f=100,i={d},q=2", .{id});
86+ first = false;
87+ if (more) try w.writeAll(",m=1");
88+ } else if (more) {
89+ try w.writeAll("\x1b_Gm=1");
90+ } else {
91+ try w.writeAll("\x1b_G");
92+ }
93+ try w.writeAll(";");
94+ try w.writeAll(data[off..end]);
95+ try w.writeAll("\x1b\\");
96+ off = end;
97+ }
98+}
99+
100+/// Transmit the PNG, place it virtually, and lay out the Unicode placeholder
101+/// grid that displays it: `cols` x `rows` cells, each row tagged with its index.
102+fn emit(w: *std.Io.Writer, id: u32, cols: usize, rows: usize, data: []const u8) !void {
103+ try transmit(w, id, data);
104+ try w.print("\x1b_Ga=p,U=1,i={d},c={d},r={d},q=2\x1b\\", .{ id, cols, rows });
105+ const r: u8 = @intCast((id >> 16) & 0xFF);
106+ const g: u8 = @intCast((id >> 8) & 0xFF);
107+ const b: u8 = @intCast(id & 0xFF);
108+ var row: usize = 0;
109+ while (row < rows) : (row += 1) {
110+ try w.print("\x1b[38;2;{d};{d};{d}m", .{ r, g, b });
111+ var col: usize = 0;
112+ while (col < cols) : (col += 1) {
113+ try writeCp(w, placeholder_cp);
114+ // The first cell of each row carries the row; the rest inherit.
115+ if (col == 0) try writeCp(w, diacritics[row]);
116+ }
117+ try w.writeAll("\x1b[39m\r\n");
118+ }
119+}
120+
121+/// Build the kitty graphics sequence that transmits a PNG, creates a virtual
122+/// placement for it, and lays out the Unicode placeholder grid that displays it.
123+/// Sized to fit `avail_cols` columns and at most `max_rows` rows. Returns null
124+/// when the image is not a PNG whose size can be read.
125+pub fn block(a: std.mem.Allocator, id: u32, image: message_mod.ImageContent, avail_cols: usize, max_rows: usize, cell_w: usize, cell_h: usize) ?[]const u8 {
126+ if (!std.mem.eql(u8, image.mime_type, "image/png")) return null;
127+ const size = pngSize(image.data) orelse return null;
128+ if (avail_cols == 0 or max_rows == 0 or cell_w == 0 or cell_h == 0) return null;
129+ const img_w: f64 = @floatFromInt(size.w);
130+ const img_h: f64 = @floatFromInt(size.h);
131+ const fit_w: f64 = @floatFromInt(avail_cols * cell_w);
132+ const row_cap = @min(max_rows, max_placeholder_rows);
133+ const fit_h: f64 = @floatFromInt(row_cap * cell_h);
134+ const scale = @min(@min(fit_w / img_w, fit_h / img_h), 1);
135+ const cols: usize = @min(@max(1, @as(usize, @intFromFloat(@round(img_w * scale / @as(f64, @floatFromInt(cell_w)))))), avail_cols);
136+ const rows: usize = @min(@max(1, @as(usize, @intFromFloat(@round(img_h * scale / @as(f64, @floatFromInt(cell_h)))))), row_cap);
137+
138+ var out: std.Io.Writer.Allocating = .init(a);
139+ emit(&out.writer, id & placeholder_id_mask, cols, rows, image.data) catch {
140+ out.deinit();
141+ return null;
142+ };
143+ return out.written();
144+}
src/tui/screen.zig+23−8
@@ -83,21 +83,36 @@ pub const Scrollback = struct {
8383 self.buf.clearRetainingCapacity();
8484 }
8585
86+ fn appendBytes(self: *Scrollback, bytes: []const u8) void {
87+ self.buf.appendSlice(self.a, bytes) catch {};
88+ }
89+
90+ /// Append a committed row: bytes plus a line break, marking progress.
91+ fn appendRow(self: *Scrollback, bytes: []const u8) void {
92+ self.appendBytes(bytes);
93+ self.appendBytes("\r\n");
94+ self.wrote = true;
95+ self.last_blank = false;
96+ }
97+
8698 pub fn push(self: *Scrollback, line: []const u8) void {
8799 const clean = render.sanitize(self.scratch, line);
88100 const blank = clean.len == 0 or (self.separator and self.wrote);
89101 self.separator = false;
90102 if (blank and self.wrote and !self.last_blank) {
91- self.buf.appendSlice(self.a, render.paintRow(self.scratch, "")) catch {};
92- self.buf.appendSlice(self.a, "\r\n") catch {};
103+ self.appendBytes(render.paintRow(self.scratch, ""));
104+ self.appendBytes("\r\n");
93105 self.last_blank = true;
94106 }
95- if (clean.len != 0) {
96- self.buf.appendSlice(self.a, render.paintRow(self.scratch, clean)) catch {};
97- self.buf.appendSlice(self.a, "\r\n") catch {};
98- self.wrote = true;
99- self.last_blank = false;
100- }
107+ if (clean.len != 0) self.appendRow(render.paintRow(self.scratch, clean));
108+ }
109+
110+ /// Append pre-built bytes verbatim, bypassing sanitizing and wrapping. Used
111+ /// for terminal escape sequences such as image graphics.
112+ pub fn pushRaw(self: *Scrollback, bytes: []const u8) void {
113+ if (bytes.len == 0) return;
114+ self.separator = false;
115+ self.appendRow(bytes);
101116 }
102117
103118 pub fn commitLines(self: *Scrollback, lines: []const render.BodyLine) void {
src/tui/term.zig+14−0
@@ -4,6 +4,9 @@ const platform = @import("../platform.zig");
44 const EXIT_SEQUENCE = "\x1b[<u\x1b[?2004l";
55 const ENTER_SEQUENCE = "\x1b[?2004h\x1b[>1u\x1b[?u";
66
7+/// Cell size in pixels assumed when the terminal does not report window pixels.
8+const fallback_cell = [2]usize{ 10, 20 };
9+
710 var saved: std.posix.termios = undefined;
811 var raw_mode = std.atomic.Value(bool).init(false);
912 var entered = std.atomic.Value(bool).init(false);
@@ -20,6 +23,7 @@ pub fn restore() void {
2023 pub const Terminal = struct {
2124 started: bool = false,
2225 winsize: [2]usize = .{ 80, 24 },
26+ pixels: [2]usize = .{ 0, 0 },
2327
2428 pub fn width(self: *Terminal) usize {
2529 return self.winsize[0];
@@ -29,6 +33,14 @@ pub const Terminal = struct {
2933 return self.winsize[1];
3034 }
3135
36+ /// Cell size in pixels, with a typical fallback for terminals that do not
37+ /// report the pixel dimensions of the window.
38+ pub fn cell(self: *Terminal) [2]usize {
39+ const w = if (self.winsize[0] > 0 and self.pixels[0] > 0) self.pixels[0] / self.winsize[0] else fallback_cell[0];
40+ const h = if (self.winsize[1] > 0 and self.pixels[1] > 0) self.pixels[1] / self.winsize[1] else fallback_cell[1];
41+ return .{ @max(w, 1), @max(h, 1) };
42+ }
43+
3244 pub fn refreshSize(self: *Terminal) void {
3345 var wsz: std.posix.winsize = .{ .row = 0, .col = 0, .xpixel = 0, .ypixel = 0 };
3446 const r = platform.io.operate(.{ .device_io_control = .{
@@ -39,6 +51,8 @@ pub const Terminal = struct {
3951 if (r.device_io_control >= 0) {
4052 if (wsz.col > 0) self.winsize[0] = wsz.col;
4153 if (wsz.row > 0) self.winsize[1] = wsz.row;
54+ if (wsz.xpixel > 0) self.pixels[0] = wsz.xpixel;
55+ if (wsz.ypixel > 0) self.pixels[1] = wsz.ypixel;
4256 }
4357 }
4458
src/tui/tui.zig+33−4
@@ -19,6 +19,7 @@ const commands = @import("commands.zig");
1919 const usage_mod = @import("usage.zig");
2020 const diff_view = @import("diff_view.zig");
2121 const tool_view = @import("tool_view.zig");
22+const image_view = @import("image.zig");
2223 const screen = @import("screen.zig");
2324 const history = @import("../history.zig");
2425 const status = @import("../status.zig");
@@ -73,6 +74,7 @@ const Tui = struct {
7374 sa: std.mem.Allocator,
7475 calls: std.heap.ArenaAllocator,
7576 ca: std.mem.Allocator = undefined,
77+ image_seq: u32 = 0,
7678
7779 input_bytes: std.ArrayList(u8) = .empty,
7880 input_batch: std.ArrayList(u8) = .empty,
@@ -431,7 +433,7 @@ const Tui = struct {
431433 .tool_args => |n| self.writing_bytes = n,
432434 .tool_output => {},
433435 .message => |am| self.commitMessage(am),
434- .tool_result => |tr| self.commitToolResult(tr.name, tr.text, tr.is_error, tr.diffs, tr.body),
436+ .tool_result => |tr| self.commitToolResult(tr.name, tr.text, tr.is_error, tr.diffs, tr.body, tr.images),
435437 .err => |m| {
436438 self.reportStatus("error", null, m);
437439 self.endTurn(styles.err(self.s, std.fmt.allocPrint(self.s, "! {s}", .{m}) catch "! error"));
@@ -479,7 +481,7 @@ const Tui = struct {
479481 }
480482 }
481483
482- fn commitToolResult(self: *Tui, name: []const u8, text: []const u8, is_error: bool, diffs: []const tools_index.FileDiff, body: ?[]const u8) void {
484+ fn commitToolResult(self: *Tui, name: []const u8, text: []const u8, is_error: bool, diffs: []const tools_index.FileDiff, body: ?[]const u8, images: []const message_mod.ImageContent) void {
483485 self.scrollback.separator = true;
484486 const shown = render.stripAnsi(self.s, text);
485487 const meta: ?[]const u8 = if (!is_error) body else null;
@@ -487,6 +489,7 @@ const Tui = struct {
487489 const call = self.pending_calls.orderedRemove(0);
488490 self.commitLines(tool_view.callBody(self.s, call.name, call.summary, meta));
489491 }
492+ if (self.cfg.show_images) self.commitImages(images);
490493 if (meta == null) {
491494 const width = @max(self.term.width() - BODY_PREFIX.len, 1);
492495 const is_bash = std.mem.eql(u8, name, "bash");
@@ -509,6 +512,21 @@ const Tui = struct {
509512 self.scrollback.separator = true;
510513 }
511514
515+ fn commitImages(self: *Tui, images: []const message_mod.ImageContent) void {
516+ if (images.len == 0) return;
517+ const width = @max(self.term.width(), 1);
518+ const max_rows = @max(self.term.height() -| 2, 1);
519+ const cell = self.term.cell();
520+ const salt: u8 = @truncate(@as(u64, @bitCast(time.nowMs())));
521+ for (images) |image| {
522+ self.image_seq +%= 1;
523+ const id = image_view.imageId(salt, self.image_seq);
524+ if (image_view.block(self.s, id, image, width, max_rows, cell[0], cell[1])) |bytes| {
525+ self.scrollback.pushRaw(bytes);
526+ }
527+ }
528+ }
529+
512530 fn flushCalls(self: *Tui) void {
513531 for (self.pending_calls.items) |call| {
514532 self.scrollback.separator = true;
@@ -1009,7 +1027,7 @@ fn turnThread(self: *Tui) void {
10091027 self.turn_done.store(true, .seq_cst);
10101028 }
10111029
1012-fn copyEvent(a: std.mem.Allocator, e: agent.Event) agent.Event {
1030+fn copyEvent(a: std.mem.Allocator, e: agent.Event, with_images: bool) agent.Event {
10131031 return switch (e) {
10141032 .phase => |p| .{ .phase = .{ .phase = p.phase, .detail = if (p.detail) |d| a.dupe(u8, d) catch "" else null } },
10151033 .text => |s| .{ .text = a.dupe(u8, s) catch "" },
@@ -1031,12 +1049,23 @@ fn copyEvent(a: std.mem.Allocator, e: agent.Event) agent.Event {
10311049 };
10321050 diffs = buf;
10331051 } else |_| {}
1052+ var images: []const message_mod.ImageContent = &.{};
1053+ if (with_images) {
1054+ if (a.alloc(message_mod.ImageContent, tr.images.len)) |buf| {
1055+ for (tr.images, 0..) |img, i| buf[i] = .{
1056+ .data = a.dupe(u8, img.data) catch "",
1057+ .mime_type = a.dupe(u8, img.mime_type) catch "",
1058+ };
1059+ images = buf;
1060+ } else |_| {}
1061+ }
10341062 break :blk .{ .tool_result = .{
10351063 .name = a.dupe(u8, tr.name) catch "",
10361064 .text = a.dupe(u8, tr.text) catch "",
10371065 .is_error = tr.is_error,
10381066 .diffs = diffs,
10391067 .body = if (tr.body) |b| a.dupe(u8, b) catch "" else null,
1068+ .images = images,
10401069 } };
10411070 },
10421071 else => e,
@@ -1050,7 +1079,7 @@ fn eventTrampoline(ctx: *anyopaque, event: agent.Event) void {
10501079 else => {},
10511080 }
10521081 self.event_mutex.lockUncancelable(platform.io);
1053- self.events.append(platform.gpa, copyEvent(self.q, event)) catch {};
1082+ self.events.append(platform.gpa, copyEvent(self.q, event, self.cfg.show_images)) catch {};
10541083 self.event_mutex.unlock(platform.io);
10551084 }