mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
lua api start
This commit is contained in:
parent
840196d650
commit
cceffbf474
5 changed files with 87 additions and 8 deletions
3
README.md
Normal file
3
README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Mezzaluna
|
||||
|
||||
WIP wayland compositor.
|
||||
83
api.lua
Normal file
83
api.lua
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
---------------- Windowing ----------------
|
||||
local root_tile = {
|
||||
tile_parent = nil,
|
||||
direction = "horizontal", -- or "vertical"
|
||||
children = { },
|
||||
}
|
||||
|
||||
local window = {
|
||||
pos = { x = 100, y = 200 },
|
||||
size = { w = 640, h = 360 },
|
||||
window = nil
|
||||
}
|
||||
|
||||
-- Master stack as an example, using attach asside
|
||||
mez.add_hook("NewWindow", {
|
||||
-- pattern = { "foot", "firefox" },
|
||||
callback = function (new_window)
|
||||
local root = mez.get_root_tile() -- Maybe mez.get_current_workspace().root_tile
|
||||
|
||||
if (#root.children == 0) then
|
||||
root.children[#root.children + 1] = new_window
|
||||
elseif (#root.children == 1) then
|
||||
root.children[#root.children + 1] = mez.tile.create(root, "vertical", { new_window })
|
||||
else
|
||||
local stack = root.children[2]
|
||||
stack.children[#stack.children + 1] = new_window
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Floating
|
||||
mez.add_hook("NewWindow", {
|
||||
callback = function (new_window)
|
||||
local last_window = mez.floating_windows[#mez.floating_windows]
|
||||
|
||||
new_window.pos = { last_window.pos.x + 50, last_window.pos.y + 50 }
|
||||
new_window.size = last_window.size
|
||||
|
||||
mez.floating_windows[#mez.floating_windows + 1] = new_window
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
mez.add_hook("NewWindowPre", {
|
||||
callback = function (new_window)
|
||||
local last_window = mez.floating_windows[#mez.floating_windows]
|
||||
|
||||
new_window.pos = { last_window.pos.x + 50, last_window.pos.y + 50 }
|
||||
new_window.size = last_window.size
|
||||
|
||||
mez.floating_windows[#mez.floating_windows + 1] = new_window
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
---------------- Options ----------------
|
||||
|
||||
mez.options = {
|
||||
windows = {
|
||||
borders = {
|
||||
{ thickness = 3, color = "#ff0000" },
|
||||
{ thickness = 3, color = "#00ff00" },
|
||||
{ thickness = 3, color = "#0000ff" },
|
||||
},
|
||||
border_radius = 5,
|
||||
gaps = {
|
||||
inner = 10,
|
||||
outer = 100 -- lukesmith ahh desktop
|
||||
}
|
||||
},
|
||||
popups = nil, -- same options as windows, mimic window options if nil
|
||||
output = {
|
||||
["eDP-1"] = {
|
||||
brightness = 0.25,
|
||||
rate = "60.00",
|
||||
resolution = "1920x1080",
|
||||
right_of = "HDMI-1"
|
||||
},
|
||||
["HDMI-1"] = { }
|
||||
}
|
||||
}
|
||||
|
||||
-- Virtual terminal switching
|
||||
|
|
@ -14,7 +14,6 @@ pub fn build(b: *std.Build) void {
|
|||
// 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");
|
||||
|
|
|
|||
|
|
@ -10,13 +10,7 @@
|
|||
* Not using the bindings is most likey a LOT of extra work
|
||||
|
||||
# Names
|
||||
* Selene
|
||||
* Chandra - wtf
|
||||
* Phoeb - Horrible to write in code
|
||||
* Mezzaluna (mez)
|
||||
* Gibbous (gib)
|
||||
* Monzonite (monz)
|
||||
* Slasagna
|
||||
|
||||
# Style Guide
|
||||
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ const std = @import("std");
|
|||
const Server = @import("server.zig").Server;
|
||||
|
||||
pub fn main() !void {
|
||||
std.debug.print("Starting wwm");
|
||||
std.debug.print("Starting mezzaluna", .{});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue