probonopd / Filer

A clean rewrite of the Filer file manager for helloSystem, inspired by John Siracusa's descriptions of "Spatial Orientation"
BSD 2-Clause "Simplified" License
13 stars 1 forks source link

[Wayland] Shows desktop in a window rather than in the background #16

Open probonopd opened 11 months ago

probonopd commented 11 months ago

Raspberry Pi OS, when running in Wayland (as it is the default) shows the desktop in a window rather than in the background.

image

In the Xorg session it works correctly.

Some possibly relevant details:

$ env | grep way
WLR_XWAYLAND=/usr/bin/xwayland-xauth
DESKTOP_SESSION=LXDE-pi-wayfire
XDG_SESSION_DESKTOP=LXDE-pi-wayfire
XDG_SESSION_TYPE=wayland
WAYLAND_DISPLAY=wayland-1
GDMSESSION=LXDE-pi-wayfire
WAYFIRE_CONFIG_FILE=/home/user/.config/wayfire.ini

Someone knowledgable in Wayland would need to look at this.

probonopd commented 11 months ago

It seems like "shell" is Wayland terminology for desktop environment components such as desktop backgrounds, panels, the menu, etc.

https://drewdevault.com/2018/07/29/Wayland-shells.html

The layer-shell is organized into four discrete layers: background, bottom, top, and overlay, which are rendered in that order. Between bottom and top, application windows are displayed. A wallpaper client might choose to go in the bottom layer, while a notification could show on the top layer, and a panel on the bottom layer.

There seems to be a Qt specific implementation: https://github.com/KDE/layer-shell-qt

Related:

probonopd commented 11 months ago

It seems like something along the lines of

https://github.com/johanmalm/tint/blob/2b90a2802cace702c5f848d52adc1cecc13684db/panel.cpp#L15-L42

would need to be done to use the layer shell protocol. The downside is that we then would have Wayland specific dependencies in Filer, but we could #ifdef them.

#ifdef HAVE_X11
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#endif
#ifdef HAVE_WAYLAND
#include <LayerShellQt/shell.h>
#include <LayerShellQt/window.h>
#endif

which would have the advantage that we possibly wouldn't need to pull Wayland specific code or dependencies into Filer. The downside woud be that it would only work in Wayfire (and Wayfire uses some Gnome stack instead of Qt, which we don't want).

Simply adding

(...)
// Wayland
#include <LayerShellQt/Window>
#include <LayerShellQt/Shell>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    // Wayland
    LayerShellQt::Shell::useLayerShell();
(...)

in main.cpp results all Filer "windows" (including even menus) to be fullscreen and in front of any other windows. This is clearly not what we want! Why is this happening? It should leave all "windows" alone except for the "window" that shall be rendered on the desktop.

probonopd commented 11 months ago

If we "just" want to enable Wayfire (a lightweight wlroots-based Wayland compositor used e.g., by Raspberry Pi OS) to run Filer properly, we might be able to do something like @marcusbritanicus has done for LXQt

https://gitlab.com/wayfireplugins/lxqt-desktop-shell/

Not clear how to even build that, asked at https://gitlab.com/wayfireplugins/lxqt-desktop-shell/-/issues/6 and asked more generically over at https://gitlab.com/wayfireplugins/lxqt-desktop-shell/-/issues/7.

marcusbritanicus commented 11 months ago

@probonopd I've commented on both the issues. Feel free to reach out if you have any other queries. I think it would be easier if you could join me on matrix or discord. Since you're developing a DE (or DE components), it would be great to have you in the room. :slightly_smiling_face:

  1. DesQ: Matrix Discord
  2. DFL Matrix Discord

DesQ is my effort to build a Qt-based DE with Wayfire as the compositor DFL stands for Desktop Framework Libraries, a bunch of light-weight pure Qt libraries useful in building a Qt based DE. This is the equivalent of KDE's Frameworks.