From 8110bb2773b6c841029a51eca7971f42a36f480c Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Tue, 2 Apr 2024 00:58:00 +0200 Subject: Rewrite srdwm in Rust: working X11 and Wayland backends, Lua config The C++ prototype (moved to legacy-cpp/) was mostly a design skeleton: X11 and Windows backends were partially real, Wayland created the wlroots object graph but never wired a single event listener, macOS was stub except monitor enumeration, and the Lua engine's srd.bind() stored a key-combo string but never the actual closure. See docs/PRIOR_ART.md for the full audit. This replaces it with a Cargo workspace: - srdwm-core: platform-independent window/workspace/monitor state, a real master-stack tiling layout, and SmartPlacement grid/cascade/ snap-to-edge placement - fixing several bugs in the C++ version (hardcoded 2-column grid, cascade that never cascaded, snap-to-edge that always returned a fixed rect). 35 unit tests. - srdwm-config: the srd Lua API via mlua, implementing the surface docs/DEFAULTS.md always documented but the C++ engine never actually built (srd.window.close()/focus(direction), srd.workspace.next(), real keybinding closures, require("srd") support). 10 unit tests. - srdwm-x11: a real reparenting WM with a drawn title bar (buttons, drag, resize), verified live under Xephyr - frame placement and client offset match srdwm-core's computed geometry exactly, and the decoration renders correctly on screen. - srdwm-wayland: a from-scratch smithay compositor (the C++ version had nothing working to port from) - runs via the winit backend, tracks xdg-shell toplevels through the same WindowManager and hit-testing code X11 uses, verified to start/render/run without crashing. Decorations are solid-color (no text yet); see docs/IMPLEMENTATION_STATUS.md for exact scope. - srdwm-windows / srdwm-macos: structured, cfg-gated designs informed by komorebi/glazewm and yabai/AeroSpace respectively (see docs/PRIOR_ART.md), honestly marked as unbuilt/unverified since this sandbox has no Windows or macOS target. --- config/srd/test_decorations.lua | 127 ---------------------------------------- 1 file changed, 127 deletions(-) delete mode 100644 config/srd/test_decorations.lua (limited to 'config/srd/test_decorations.lua') diff --git a/config/srd/test_decorations.lua b/config/srd/test_decorations.lua deleted file mode 100644 index 2b49d0a..0000000 --- a/config/srd/test_decorations.lua +++ /dev/null @@ -1,127 +0,0 @@ -- Test configuration for decoration and window state controls -- This file demonstrates the cross-platform decoration and tiling/floating functionality - -print("Loading decoration and window state test configuration...") - -- Global decoration settings -srd.set("general.decorations_enabled", true) -srd.set("general.border_width", 3) -srd.set("general.border_color", "#2e3440") - -- Keybindings for decoration and window state controls -srd.bind("Mod4+d", function() - - Toggle decorations for focused window - local window = srd.window.focused() - if window then - local current = srd.window.get_decorations(window.id) - srd.window.set_decorations(window.id, not current) - print("Toggled decorations for window " .. window.id) - end -end) - -srd.bind("Mod4+b", function() - - Toggle border color for focused window - local window = srd.window.focused() - if window then - srd.window.set_border_color(window.id, 255, 0, 0) - Red border - print("Set red border for window " .. window.id) - end -end) - -srd.bind("Mod4+n", function() - - Toggle border color back to normal - local window = srd.window.focused() - if window then - srd.window.set_border_color(window.id, 46, 52, 64) - Default color - print("Reset border color for window " .. window.id) - end -end) - -srd.bind("Mod4+w", function() - - Toggle border width - local window = srd.window.focused() - if window then - srd.window.set_border_width(window.id, 8) - Thick border - print("Set thick border for window " .. window.id) - end -end) - -srd.bind("Mod4+s", function() - - Reset border width - local window = srd.window.focused() - if window then - srd.window.set_border_width(window.id, 3) - Normal border - print("Reset border width for window " .. window.id) - end -end) - -- Window state controls -srd.bind("Mod4+f", function() - - Toggle floating state for focused window - local window = srd.window.focused() - if window then - srd.window.toggle_floating(window.id) - local floating = srd.window.is_floating(window.id) - print("Window " .. window.id .. " floating: " .. tostring(floating)) - end -end) - -srd.bind("Mod4+t", function() - - Set window to tiling mode - local window = srd.window.focused() - if window then - srd.window.set_floating(window.id, false) - print("Set window " .. window.id .. " to tiling mode") - end -end) - -srd.bind("Mod4+l", function() - - Set window to floating mode - local window = srd.window.focused() - if window then - srd.window.set_floating(window.id, true) - print("Set window " .. window.id .. " to floating mode") - end -end) - -- Layout switching with decoration awareness -srd.bind("Mod4+1", function() - srd.layout.set("tiling") - print("Switched to tiling layout") -end) - -srd.bind("Mod4+2", function() - srd.layout.set("dynamic") - print("Switched to dynamic layout") -end) - -srd.bind("Mod4+3", function() - srd.layout.set("floating") - print("Switched to floating layout") -end) - -- Test function to apply decorations to all windows -function apply_test_decorations() - print("Applying test decorations to all windows...") - - - This would iterate through all windows in a real implementation - - For now, we'll just demonstrate the API - - - Example: Apply red border to window with ID "1" - srd.window.set_border_color("1", 255, 0, 0) - srd.window.set_border_width("1", 5) - - - Example: Apply blue border to window with ID "2" - srd.window.set_border_color("2", 0, 0, 255) - srd.window.set_border_width("2", 3) - - - Example: Disable decorations for window with ID "3" - srd.window.set_decorations("3", false) - - print("Test decorations applied") -end - -- Call the test function -apply_test_decorations() - -print("Decoration and window state test configuration loaded successfully!") -- cgit v1.2.3