hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.45k stars 897 forks source link

Hyprland Specific Foreign Top-level Manager #6879

Open caffineehacker opened 3 months ago

caffineehacker commented 3 months ago

Description

What's the opinion of creating a Hyprland specific Wayland protocol for a foreign top-level manager? Right now both the wlr and regular extension lack a lot of detail about Windows which can only be gathered via the socket. Unfortunately, the socket isn't a great avenue for every detail change and the window address there is not comparable to the wlr id (although I can link it to the regular ext protocol, that isn't guaranteed to always work).

I'm happy to put in the work to make the protocol definition and plumb it to the right places since I think it could be quite valuable. The plan would be to have a top-level object with all the same properties as hyprctl clients shows with the added benefit of foreign keys to the monitors. We may also need a workspace protocol in the future if this works well. Since these would be a private hyprland protocol it would be easy to add and remove fields / actions / events.

vaxerski commented 3 months ago

what would be some examples of usage that both these managers lack that a vendored protocol would allow?

caffineehacker commented 3 months ago

zwlr_foreign_toplevel_manager_v1 lets us do the following:

ext_foreign_toplevel_list_v1:

Hyprland sockets:

What I'm trying to do and why I'm finding it difficult:

Proposed interface would be an extension like ext_foreign_toplevel_list_v1 which explicitly calls out " This protocol is intentionally minimalistic and expects additional functionality (e.g. creating a screencopy source from a toplevel handle, getting information about the state of the toplevel) to be implemented in extension protocols.". The top level object would support all of the same information available about a client from the socket clients command with the added benefit of using the same object ids as other Wayland protocols (e.g. zwlr_output_head_v1 for the outputs). Ideally there would also be a workspace protocol for indicating workspaces that exist and which one is active so that id could be referenced from the workspace value of the top level as well.

If we go this route, one choice will be whether we purely extend ext_foreign_toplevel_list_v1 by making a protocol that takes an ext_foreign_toplevel_handle_v1 and gives back a hyprland_foreign_toplevel_handle_v1 which has the Hyprland events or if we want a new hyprland_foreign_toplevel_manager_v1.

I know there is probably a lot of opinion over whether the socket or the wayland protocol is likely better or more efficient way of communicating, but the clear delineation of data and the easier to use model of a wayland protocol makes that a better choice in my opinion, but I'm happy to hear other opinions.

vaxerski commented 3 months ago

meh, dunno if this is that needed.

caffineehacker commented 3 months ago

Given I'm willing to do the work and the maintenance should be pretty low, what's the risk?

Also, what's your opinion on having the draft ext-workspace-unstable protocol implemented (https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/40)? Having an object oriented interface is significantly better than using the sockets for communicating and understanding the state of the desktop.

vaxerski commented 3 months ago

it used to be implemented but was dropped. It also doesn't work very well with how we use workspaces.

Given I'm willing to do the work and the maintenance should be pretty low, what's the risk?

Sure, but this discussion should take place in a draft MR to hyprland-protocols