Skip to content

refactor(exec-lib): vendor hyprland toplevel mapping protocol - #518

Open
sim590 wants to merge 1 commit into
H3rmt:hyprshellfrom
sim590:vendor-toplevel-mapping-proto
Open

refactor(exec-lib): vendor hyprland toplevel mapping protocol#518
sim590 wants to merge 1 commit into
H3rmt:hyprshellfrom
sim590:vendor-toplevel-mapping-proto

Conversation

@sim590

@sim590 sim590 commented Aug 22, 2026

Copy link
Copy Markdown

As discussed in #488, this vendors the hyprland-toplevel-mapping-v1.xml protocol spec directly from hyprwm/hyprland-protocols (commit bd153e76f751f150a09328dbdeb5e4fab9d23622, the exact revision embedded in wayland-protocols-hyprland 1.2.0) and drops the wayland-protocols-hyprland crate.

Bindings are generated at compile time with wayland-scanner, using the same module layout as the former crate, so the diff in wayland_capture.rs is limited to the import paths.

Notes:

  • wayland-protocols-wlr becomes a direct dependency: the protocol's get_window_for_toplevel_wlr request references zwlr_foreign_toplevel_handle_v1. It was already in the workspace lock file.
  • Dropping the crate also removes its LGPL-3.0 dependency from the tree; the vendored XML is BSD-3-Clause.
  • nix/build.nix keeps .xml files in the cargo source tree since crane's filterCargoSources would otherwise exclude them.

Regarding avoiding hyprland-specific protocols entirely: the toplevel mapping is what ties Wayland toplevels to Hyprland window addresses, which hyprshell identifies clients by. I don't see a standard protocol providing that mapping, so this one stays.

Replace the wayland-protocols-hyprland crate with the vendored
hyprland-toplevel-mapping-v1.xml from hyprwm/hyprland-protocols at
commit bd153e76f751f150a09328dbdeb5e4fab9d23622, the exact revision
embedded in wayland-protocols-hyprland 1.2.0.

Bindings are generated at compile time with wayland-scanner. This
drops the unmaintained third-party crate and its LGPL-3.0 dependency
while keeping the exact same protocol revision.

wayland-protocols-wlr becomes a direct dependency since the protocol
references zwlr_foreign_toplevel_handle_v1.
@sim590

sim590 commented Aug 22, 2026

Copy link
Copy Markdown
Author

@H3rmt: disclamer: I was not familiar at all with this procedure and I just decided to let Deepseek do it. I tested and it still compiled and worked as it should.

I took a look at the result and I pretty much don't see anywhere it could go wrong. The import instructions are replaced for our own local module and still does what it should so it seems alright.

Feel free to ask for any changes, of course.

Comment thread nix/build.nix
pkgs,
}:
rec {
# Vendored wayland protocol XML files must be kept in the cargo source

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed as src being ../. Also includes all files

Comment thread nix/build.nix
cargoArtifacts = craneLib.buildDepsOnly (
commonArgs
// {
src = craneLib.cleanCargoSource ../.;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I see this is why

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although, this part was not easily testable for me as the nix file setup seems to be broken. I get errors in the pipeline about it and my local build doesn't work either. Deepseek was trying to fix it, but I stopped it since it's not related to this PR.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check it myself when I am back from holiday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants