diff --git a/README.md b/README.md index 68f4855..e8ed795 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,9 @@ You will need: - NixOS: There is flake [`flake.nix`](flake.nix) with a devShell. It also includes the other tools needed for the build and sets up the `LD_LIBRARY_PATH` so the dynamically loaded libraries are found. + > [!NOTE] + > Luarocks currently doesn't install the Lua library and its dependencies due to openssh directory + > shenanigans. Fix soon, hopefully. In the meantime you can use the Rust API. - [protoc](https://grpc.io/docs/protoc-installation/), the Protocol Buffer Compiler, for configuration - Arch: ```sh diff --git a/flake.lock b/flake.lock index 9fb6427..b8f7dcf 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1712816664, - "narHash": "sha256-kPIVs2ATag+gm1CiWCJ+qcVQVR89w2eh/Cg4g1Xph70=", + "lastModified": 1712903033, + "narHash": "sha256-KcvsEm0h1mIwBHFAzWFBjGihnbf2fxpAaXOdVbUfAI4=", "owner": "nix-community", "repo": "fenix", - "rev": "94f8df6a8e52447af72a1a0008eccf4a099b6d25", + "rev": "c739f83545e625227f4d0af7fe2a71e69931fa4c", "type": "github" }, "original": { @@ -41,11 +41,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1712741485, - "narHash": "sha256-bCs0+MSTra80oXAsnM6Oq62WsirOIaijQ/BbUY59tR4=", + "lastModified": 1712867921, + "narHash": "sha256-edTFV4KldkCMdViC/rmpJa7oLIU8SE/S35lh/ukC7bg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b2cf36f43f9ef2ded5711b30b1f393ac423d8f72", + "rev": "51651a540816273b67bc4dedea2d37d116c5f7fe", "type": "github" }, "original": { @@ -65,11 +65,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1712663608, - "narHash": "sha256-tN9ZL6kGppmHg84lxlpAlaN+kXWNctKK7Yitq/iXDEw=", + "lastModified": 1712818880, + "narHash": "sha256-VDxsvgj/bNypHq48tQWtc3VRbWvzlFjzKf9ZZIVO10Y=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "a5feb4f05f09adca661c869b1bf2324898cbaa43", + "rev": "657b33b0cb9bd49085202e91ad5b4676532c9140", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 85320a1..a45ae39 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,6 @@ { - description = " A WIP Smithay-based Wayland compositor, inspired by AwesomeWM and configured in Lua or Rust"; + description = + "A WIP Smithay-based Wayland compositor, inspired by AwesomeWM and configured in Lua or Rust"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; @@ -12,48 +13,53 @@ flake-utils.url = "github:numtide/flake-utils"; }; - outputs = - { - nixpkgs, - flake-utils, - fenix, - ... - }: - flake-utils.lib.eachSystem - [ - "x86_64-linux" - "aarch64-linux" - ] - ( - system: - let - pkgs = nixpkgs.legacyPackages.${system}; - fenixPkgs = fenix.packages.${system}; - toolchain = fenixPkgs.stable; - combinedToolchain = toolchain.completeToolchain; - in - { - devShell = pkgs.mkShell { - buildInputs = [ - # rust devel tools - combinedToolchain - pkgs.rust-analyzer - pkgs.cargo-outdated + outputs = { nixpkgs, flake-utils, fenix, ... }: + flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + fenixPkgs = fenix.packages.${system}; + toolchain = fenixPkgs.stable; + combinedToolchain = toolchain.completeToolchain; + in { + formatter = pkgs.nixfmt; - # build time stuff - pkgs.pkg-config - pkgs.protobuf - pkgs.luarocks + devShell = pkgs.mkShell { + nativeBuildInputs = [ pkgs.pkg-config ]; + buildInputs = with pkgs; [ + # rust devel tools + combinedToolchain + rust-analyzer + cargo-outdated - # libs - pkgs.seatd.dev - pkgs.systemdLibs.dev - pkgs.libxkbcommon - pkgs.libinput - pkgs.mesa - ]; - LD_LIBRARY_PATH = "${pkgs.wayland}/lib:${pkgs.libGL}/lib"; - }; - } - ); + wayland + + # build time stuff + protobuf + lua54Packages.luarocks + + # libs + seatd.dev + systemdLibs.dev + libxkbcommon + libinput + mesa + xwayland + + # winit on x11 + xorg.libXcursor + xorg.libXrandr + xorg.libXi + xorg.libX11 + ]; + + runtimeDependencies = with pkgs; [ + wayland + mesa + libglvnd # libEGL + ]; + + LD_LIBRARY_PATH = + "${pkgs.wayland}/lib:${pkgs.libGL}/lib:${pkgs.libxkbcommon}/lib"; + }; + }); } diff --git a/src/layout.rs b/src/layout.rs index 60167a3..1d79c3b 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -1,6 +1,9 @@ // SPDX-License-Identifier: GPL-3.0-or-later -use std::collections::{HashMap, HashSet}; +use std::{ + collections::{HashMap, HashSet}, + time::Duration, +}; use pinnacle_api_defs::pinnacle::layout::v0alpha1::{layout_request::Geometries, LayoutResponse}; use smithay::{ @@ -133,6 +136,16 @@ impl State { self.space.map_element(window, loc, false); } + // HACK and FIXME: + // We are sending frames here to get offscreen windows to commit and map. + // Obviously this is a bad way to do this but its a bandaid solution + // until decent transactional layout applications are implemented. + for (win, _serial) in pending_wins { + win.send_frame(output, self.clock.now(), Some(Duration::ZERO), |_, _| { + Some(output.clone()) + }); + } + self.fixup_z_layering(); }