mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
more lua docs for zlua functions
This commit is contained in:
parent
3ccf47e0be
commit
028485d68f
4 changed files with 39 additions and 26 deletions
|
|
@ -7,6 +7,9 @@ const Lua = @import("lua.zig");
|
|||
|
||||
const gpa = std.heap.c_allocator;
|
||||
|
||||
/// ---Join any number of paths into one path
|
||||
/// ---@vararg string paths to join
|
||||
/// ---@return string?
|
||||
pub fn joinpath(L: *zlua.Lua) i32 {
|
||||
const nargs: i32 = L.getTop();
|
||||
if (nargs < 2) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ const Utils = @import("../utils.zig");
|
|||
const gpa = std.heap.c_allocator;
|
||||
const server = &@import("../main.zig").server;
|
||||
|
||||
/// ---Create a new hook on an event
|
||||
/// ---@param string|string[] event(s)
|
||||
/// ---@param table options
|
||||
pub fn add(L: *zlua.Lua) i32 {
|
||||
L.checkType(2, .table);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ fn parse_modkeys(modStr: []const u8) wlr.Keyboard.ModifierMask {
|
|||
return modifiers;
|
||||
}
|
||||
|
||||
/// ---Create a new keymap
|
||||
/// ---@param string modifiers
|
||||
/// ---@param string keys
|
||||
/// ---@param table options
|
||||
pub fn add_keymap(L: *zlua.Lua) i32 {
|
||||
var keymap: Keymap = undefined;
|
||||
keymap.options.repeat = true;
|
||||
|
|
@ -61,6 +65,9 @@ pub fn add_keymap(L: *zlua.Lua) i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/// ---Remove an existing keymap
|
||||
/// ---@param string modifiers
|
||||
/// ---@param string keys
|
||||
pub fn del_keymap(L: *zlua.Lua) i32 {
|
||||
L.checkType(1, .string);
|
||||
L.checkType(2, .string);
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ const Output = @import("../output.zig");
|
|||
|
||||
const server = &@import("../main.zig").server;
|
||||
|
||||
// ---@alias output_id integer
|
||||
/// ---@alias output_id integer
|
||||
|
||||
// ---Get the ids for all available outputs
|
||||
// ---@return output_id[]?
|
||||
/// ---Get the ids for all available outputs
|
||||
/// ---@return output_id[]?
|
||||
pub fn get_all_ids(L: *zlua.Lua) i32 {
|
||||
var it = server.root.scene.outputs.iterator(.forward);
|
||||
var index: usize = 1;
|
||||
|
|
@ -28,8 +28,8 @@ pub fn get_all_ids(L: *zlua.Lua) i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// ---Get the id for the focused output
|
||||
// ---@return output_id?
|
||||
/// ---Get the id for the focused output
|
||||
/// ---@return output_id?
|
||||
pub fn get_focused_id(L: *zlua.Lua) i32 {
|
||||
if(server.seat.focused_output) |output| {
|
||||
L.pushInteger(@intCast(output.id));
|
||||
|
|
@ -40,9 +40,9 @@ pub fn get_focused_id(L: *zlua.Lua) i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// ---Get refresh rate for the output
|
||||
// ---@param output_id output_id 0 maps to focused output
|
||||
// ---@return integer?
|
||||
/// ---Get refresh rate for the output
|
||||
/// ---@param output_id output_id 0 maps to focused output
|
||||
/// ---@return integer?
|
||||
pub fn get_rate(L: *zlua.Lua) i32 {
|
||||
const output_id: u64 = @intCast(L.checkInteger(1));
|
||||
|
||||
|
|
@ -56,9 +56,9 @@ pub fn get_rate(L: *zlua.Lua) i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// ---Get resolution in pixels of the output
|
||||
// ---@param output_id output_id 0 maps to focused output
|
||||
// ---@return { width: integer, height: integer }?
|
||||
/// ---Get resolution in pixels of the output
|
||||
/// ---@param output_id output_id 0 maps to focused output
|
||||
/// ---@return { width: integer, height: integer }?
|
||||
pub fn get_resolution(L: *zlua.Lua) i32 {
|
||||
const output_id: u64 = @intCast(L.checkInteger(1));
|
||||
|
||||
|
|
@ -81,9 +81,9 @@ pub fn get_resolution(L: *zlua.Lua) i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// ---Get the serial for the output
|
||||
// ---@param output_id output_id 0 maps to focused output
|
||||
// ---@return string?
|
||||
/// ---Get the serial for the output
|
||||
/// ---@param output_id output_id 0 maps to focused output
|
||||
/// ---@return string?
|
||||
pub fn get_serial(L: *zlua.Lua) i32 {
|
||||
const output_id: u64 = @intCast(L.checkInteger(1));
|
||||
|
||||
|
|
@ -102,9 +102,9 @@ pub fn get_serial(L: *zlua.Lua) i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// ---Get the make for the output
|
||||
// ---@param output_id output_id 0 maps to focused output
|
||||
// ---@return string?
|
||||
/// ---Get the make for the output
|
||||
/// ---@param output_id output_id 0 maps to focused output
|
||||
/// ---@return string?
|
||||
pub fn get_make(L: *zlua.Lua) i32 {
|
||||
const output_id: u64 = @intCast(L.checkInteger(1));
|
||||
|
||||
|
|
@ -123,9 +123,9 @@ pub fn get_make(L: *zlua.Lua) i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// ---Get the model for the output
|
||||
// ---@param output_id output_id 0 maps to focused output
|
||||
// ---@return stirng?
|
||||
/// ---Get the model for the output
|
||||
/// ---@param output_id output_id 0 maps to focused output
|
||||
/// ---@return stirng?
|
||||
pub fn get_model(L: *zlua.Lua) i32 {
|
||||
const output_id: u64 = @intCast(L.checkInteger(1));
|
||||
|
||||
|
|
@ -144,9 +144,9 @@ pub fn get_model(L: *zlua.Lua) i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// ---Get the description for the output
|
||||
// ---@param output_id output_id 0 maps to focused output
|
||||
// ---@return stirng?
|
||||
/// ---Get the description for the output
|
||||
/// ---@param output_id output_id 0 maps to focused output
|
||||
/// ---@return stirng?
|
||||
pub fn get_description(L: *zlua.Lua) i32 {
|
||||
const output_id: u64 = @intCast(L.checkInteger(1));
|
||||
|
||||
|
|
@ -165,9 +165,9 @@ pub fn get_description(L: *zlua.Lua) i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// ---Get the description for the output
|
||||
// ---@param output_id output_id 0 maps to focused output
|
||||
// ---@return stirng
|
||||
/// ---Get the description for the output
|
||||
/// ---@param output_id output_id 0 maps to focused output
|
||||
/// ---@return stirng
|
||||
pub fn get_name(L: *zlua.Lua) i32 {
|
||||
const output_id: u64 = @intCast(L.checkInteger(1));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue