mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
we can now switch vts
This commit is contained in:
parent
976900ffa6
commit
591aa73bed
2 changed files with 23 additions and 0 deletions
|
|
@ -35,6 +35,12 @@ mez.input.add_keymap("alt", "q", {
|
|||
end
|
||||
})
|
||||
|
||||
for i = 1, 12 do
|
||||
mez.input.add_keymap("ctrl|alt", "XF86Switch_VT_"..i, {
|
||||
press = function() mez.api.chvt(i) end
|
||||
})
|
||||
end
|
||||
|
||||
-- mez.input.add_keymap("alt", "a", {
|
||||
-- press = function()
|
||||
-- print("hello from my keymap")
|
||||
|
|
|
|||
|
|
@ -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