xfdesktop & wayland
Brian Tarricone
brian at tarricone.org
Mon Sep 19 11:32:06 CEST 2022
Hey all,
A post on HN got me interested in Wayland again, and I decided to see where my favorite DE was wrt Wayland. I was excited to find out that there's been some work in that area, especially the recent thread about xfce4-panel. Saw the wiki page and that xfdesktop crashes on startup with Wayland, so I thought I'd take a look (xfdesktop will always have a special place in my heart, and it's been... oh my, 13 years since I last worked on it!).
Anyhow, I did some preliminary work, and got xfdesktop to the point where it comes up properly and draws the desktop background. I ended up using the gtk-layer-shell library[0] (a work of frightening yet useful hackery to be able to use the wlr-layer-shell-unstable-v1 protocol[1] with GTK) to push xfdesktop's window to the bottom of the stack.
My branch[2] is super rough and needs some significant refactoring, but feel free to check it out if you want.
One open issue is runtime detection of X11 vs. Wayland. I didn't see anything in GTK that lets you query the active windowing backend (to be fair, though, I didn't look all that hard), so what I came up with was to get the default GdkDisplay, and then test if it's a GdkX11Display or a GdkWaylandDisplay. Is there a better way to do that? Another option would be to just use a command-line option, but I prefer to make things "just work" when possible.
The other major issue is libwnck being X11-only. I guess Wayland has a workspaces concept via a protocol extension, but there isn't a cross-windowing-environment library that lets you query them. Same issue for xfdesktop's window list menu (which also uses libwnck), where I could reuse the wlr-foreign-toplevel stuff from xfce4-panel. I kinda feel like porting libwnck to Wayland may not be the best idea due to feature mismatches, but maybe a new meta-library that has an API exposing the functionality possible on both X11 and Wayland makes sense. The X11 support could just use libwnck, while Wayland support could be written to use whatever protocols are available. I might take a swing at this if y'all think it makes sense.
Anyhow, it was fun to crack open the xfdesktop source code again after so long!
-brian
[0] https://github.com/wmww/gtk-layer-shell
[1] https://wayland.app/protocols/wlr-layer-shell-unstable-v1
[2] https://gitlab.xfce.org/kelnos/xfdesktop/-/tree/wayland
More information about the Xfce4-dev
mailing list