we can now switch vts

This commit is contained in:
Squibid 2025-10-26 12:53:44 -04:00
parent 976900ffa6
commit 591aa73bed
2 changed files with 23 additions and 0 deletions

View file

@ -1,5 +1,6 @@
const std = @import("std");
const zlua = @import("zlua");
const wlr = @import("wlroots");
const gpa = std.heap.c_allocator;
@ -57,3 +58,19 @@ pub fn exit(L: *zlua.Lua) i32 {
return 0;
}
pub fn chvt(L: *zlua.Lua) i32 {
L.checkType(1, .number);
const f = L.toNumber(-1) catch unreachable;
const n: u32 = @intFromFloat(f);
if (server.session) |session| {
wlr.Session.changeVt(session, n) catch {
L.raiseErrorStr("Failed to switch vt", .{});
};
} else {
L.raiseErrorStr("Mez has not been initialized yet", .{});
}
return 0;
}