mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-08 04:57:32 -04:00
we can now switch vts
This commit is contained in:
parent
976900ffa6
commit
591aa73bed
2 changed files with 23 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue