mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
ts don't work
This commit is contained in:
parent
49e0875a85
commit
4b3e1bbd5d
4 changed files with 67 additions and 5 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 MiB |
|
|
@ -20,8 +20,6 @@ pub fn build(b: *std.Build) void {
|
|||
// subprocessing your CLI tool.
|
||||
|
||||
// The below is copied from tinywl
|
||||
// TODO: Ensure versioning is correct
|
||||
// TODO: Ensure paths for system protocols are correct
|
||||
const scanner = Scanner.create(b, .{});
|
||||
scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml");
|
||||
scanner.addSystemProtocol("stable/tablet/tablet-v2.xml");
|
||||
|
|
|
|||
|
|
@ -6,6 +6,43 @@ mez.input.add_keymap("alt", "g", {
|
|||
end
|
||||
})
|
||||
|
||||
mez.input.add_keymap("alt", "i", {
|
||||
press = function ()
|
||||
local coroutine = require("coroutine")
|
||||
print(coroutine)
|
||||
local co = coroutine.create(function ()
|
||||
print("starting coroutine")
|
||||
local view_id = mez.view.get_focused_id()
|
||||
|
||||
local size = mez.view.get_size(view_id)
|
||||
local pos = mez.view.get_position(view_id)
|
||||
local res = mez.output.get_resolution(0)
|
||||
|
||||
local x_pos = pos.x
|
||||
local y_pos = pos.y
|
||||
local x_vel = 10
|
||||
local y_vel = 10
|
||||
|
||||
while true do
|
||||
x_pos = x_pos + x_vel
|
||||
y_pos = y_pos + y_vel
|
||||
|
||||
if x_pos + size.width > res.width or x_pos < 0 then
|
||||
x_vel = x_vel * -1
|
||||
end
|
||||
|
||||
if y_pos + size.height > res.height or y_pos < 0 then
|
||||
y_vel = y_vel * -1
|
||||
end
|
||||
|
||||
print("(" .. x_pos .. ", " .. y_pos .. ")")
|
||||
mez.view.set_position(view_id, x_pos, y_pos)
|
||||
end
|
||||
end)
|
||||
coroutine.resume(co)
|
||||
end
|
||||
})
|
||||
|
||||
local master = function()
|
||||
local config = {
|
||||
tag_count = 5,
|
||||
|
|
|
|||
|
|
@ -109,10 +109,34 @@ pub fn set_position(L: *zlua.Lua) i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// ---Resize the view by it's top left corner
|
||||
// ---Get the position of the view
|
||||
// ---@param view_id view_id 0 maps to focused view
|
||||
// ---@param width number width for view
|
||||
// ---@param height number height for view
|
||||
// ---@return { x: integer, y: integer }? Position of the view
|
||||
pub fn get_position(L: *zlua.Lua) i32 {
|
||||
const view_id = LuaUtils.coerceInteger(u64, L.checkInteger(1)) catch view_id_err(L);
|
||||
const view: ?*View = if (view_id == 0) server.seat.focused_view else server.root.viewById(view_id);
|
||||
if (view) |v| {
|
||||
L.newTable();
|
||||
|
||||
_ = L.pushString("x");
|
||||
L.pushInteger(@intCast(v.xdg_toplevel.base.geometry.x));
|
||||
L.setTable(-3);
|
||||
|
||||
_ = L.pushString("y");
|
||||
L.pushInteger(@intCast(v.xdg_toplevel.base.geometry.y));
|
||||
L.setTable(-3);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
L.pushNil();
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ---Set the size of the spesified view. Will be resized relative to
|
||||
// the view's top left corner.
|
||||
// ---@param view_id view_id 0 maps to focused view
|
||||
// ---@return
|
||||
pub fn set_size(L: *zlua.Lua) i32 {
|
||||
const view_id = LuaUtils.coerceInteger(u64, L.checkInteger(1)) catch view_id_err(L);
|
||||
// We use u32s here to enforce a minimum size of zero. The call to resize a
|
||||
|
|
@ -131,6 +155,9 @@ pub fn set_size(L: *zlua.Lua) i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// ---Get the size of the view
|
||||
// ---@param view_id view_id 0 maps to focused view
|
||||
// ---@return { width: integer, height: integer }? Size of the view
|
||||
pub fn get_size(L: *zlua.Lua) i32 {
|
||||
const view_id = LuaUtils.coerceInteger(u64, L.checkInteger(1)) catch view_id_err(L);
|
||||
const view: ?*View = if (view_id == 0) server.seat.focused_view else server.root.viewById(view_id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue