diff --git a/README.md b/README.md new file mode 100644 index 0000000..3b829db --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Mezzaluna + +WIP wayland compositor. diff --git a/api.lua b/api.lua new file mode 100644 index 0000000..3b8d7fd --- /dev/null +++ b/api.lua @@ -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 diff --git a/build.zig b/build.zig index df9b35d..7e98863 100644 --- a/build.zig +++ b/build.zig @@ -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"); diff --git a/ideation.md b/ideation.md index d00b276..8ab1538 100644 --- a/ideation.md +++ b/ideation.md @@ -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 diff --git a/src/main.zig b/src/main.zig index 6499ced..e2c2a71 100644 --- a/src/main.zig +++ b/src/main.zig @@ -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", .{}); }