Firstly by copying, pasting and editing the xsessions desktop file from icewm to lwm I have been able to get XDG_CURRENT_DESKTOP=lwm into systemd, without any other files. I can see that this is the cleanest method. That said I infer from what I saw that every display manager is doing its own thing here and that is surely less than ideal.
I have played a bit with setting up lwm-portals.conf but at the
moment I more interested in trying to see if I can lock it down
than write something I would expect to be in a default Debian
config. I found the man page for portals.conf a bit confusing
here. I have put the file in
/usr/share/xdg-desktop-portal/lwm-portals.conf but there also seem
to be implementation files in
/usr/share/xdg-desktop-portal/portals and I find that a bit
confusing.
Secondly I saw a youtube video saying that discord totally ignores sandboxing so I won't be using that for testing. I have played about with GNOME recipes and ASHPD demo and I am still not seeing much difference. From what I can see they are just following UNIX permissions with no additional sandboxing.
I am still trying to understand what is being suggested here. Working on it. I can say that if I try to build xdg-desktop-portal I get some test failures:
9/28 xdg-desktop-portal:portals / test-portals-location ERROR 26.28s killed by signal 6 SIGABRT^Mbut I don't think I had read the suggestion correctly when I tried this.
12/28 xdg-desktop-portal:portals / test-portals-openuri TIMEOUT 30.01s 9 subtests passed