tangled
alpha
login
or
join now
rockorager.dev
/
comlink
2
fork
atom
an experimental irc client
2
fork
atom
overview
issues
pulls
pipelines
update vaxis, enable notifications and redraw
rockorager.dev
1 year ago
2ab2ef0e
6b601d14
+20
-25
3 changed files
expand all
collapse all
unified
split
build.zig.zon
src
app.zig
lua.zig
+2
-2
build.zig.zon
···
7
7
.hash = "1220affeb3fe37ef09411b5a213b5fdf9bb6568e9913bade204694648983a8b2776d",
8
8
},
9
9
.vaxis = .{
10
10
-
.url = "git+https://github.com/rockorager/libvaxis#a112fc13f3b5f86afbb9e651344ee61e2208caa4",
11
11
-
.hash = "12205d7dbc6a8f597d2a7fd4dcc5b81e187710667264ceaaa916ad6cd0070129ef0d",
10
10
+
.url = "git+https://github.com/rockorager/libvaxis#a653e84b33753433d05224e061579ed1d8283a2b",
11
11
+
.hash = "1220b4e007b767425df5bcb1c61898721b8b80277819a75f0d7c6e42e574194095d5",
12
12
},
13
13
.zeit = .{
14
14
.url = "git+https://github.com/rockorager/zeit?ref=main#d943bc4bfe9e18490460dfdd64f48e997065eba8",
+13
-18
src/app.zig
···
204
204
if (key.matches('c', .{ .ctrl = true })) {
205
205
ctx.quit = true;
206
206
}
207
207
+
for (self.binds.items) |bind| {
208
208
+
if (key.matches(bind.key.codepoint, bind.key.mods)) {
209
209
+
switch (bind.command) {
210
210
+
.quit => self.should_quit = true,
211
211
+
.@"next-channel" => self.nextChannel(),
212
212
+
.@"prev-channel" => self.prevChannel(),
213
213
+
.redraw => try ctx.queueRefresh(),
214
214
+
.lua_function => |ref| try lua.execFn(self.lua, ref),
215
215
+
else => {},
216
216
+
}
217
217
+
return ctx.consumeAndRedraw();
218
218
+
}
219
219
+
}
207
220
},
208
221
else => {},
209
222
}
···
217
230
const title = try std.fmt.bufPrint(&self.title_buf, "comlink", .{});
218
231
try ctx.setTitle(title);
219
232
try ctx.tick(8, self.widget());
220
220
-
},
221
221
-
.key_press => |key| {
222
222
-
if (key.matches('c', .{ .ctrl = true })) {
223
223
-
ctx.quit = true;
224
224
-
}
225
225
-
for (self.binds.items) |bind| {
226
226
-
if (key.matches(bind.key.codepoint, bind.key.mods)) {
227
227
-
switch (bind.command) {
228
228
-
.quit => self.should_quit = true,
229
229
-
.@"next-channel" => self.nextChannel(),
230
230
-
.@"prev-channel" => self.prevChannel(),
231
231
-
// .redraw => self.vx.queueRefresh(),
232
232
-
.lua_function => |ref| try lua.execFn(self.lua, ref),
233
233
-
else => {},
234
234
-
}
235
235
-
return ctx.consumeAndRedraw();
236
236
-
}
237
237
-
}
238
233
},
239
234
.tick => {
240
235
for (self.clients.items) |client| {
+5
-5
src/lua.zig
···
361
361
lua.argCheck(lua.isString(1), 1, "expected a string"); // [string, string]
362
362
lua.argCheck(lua.isString(2), 2, "expected a string"); // [string, string]
363
363
const app = getApp(lua);
364
364
-
_ = app; // autofix
365
364
const title = lua.toString(1) catch { // [string, string]
366
365
lua.raiseErrorStr("couldn't write notification", .{});
367
366
};
368
368
-
_ = title; // autofix
369
367
const body = lua.toString(2) catch { // [string, string]
370
368
lua.raiseErrorStr("couldn't write notification", .{});
371
369
};
372
372
-
_ = body; // autofix
373
370
lua.pop(2); // []
374
374
-
// app.vx.notify(app.tty.anyWriter(), title, body) catch
375
375
-
// lua.raiseErrorStr("couldn't write notification", .{});
371
371
+
if (app.ctx) |ctx| {
372
372
+
ctx.sendNotification(title, body) catch {
373
373
+
lua.raiseErrorStr("couldn't write notification", .{});
374
374
+
};
375
375
+
}
376
376
return 0;
377
377
}
378
378