How many GPUs do you have? If only one, not possible, at least not easily.
But, to answer the question, yes I know. It's kind of a mess because the API is very much designed around display managers. Basically you need to call some DBus functions after authenticating the user but before dropping privileges to register the user with logind. The result of that is some permissions are modified to your user so the compositor has access to keyboard, GPU, mouse, etc. That makes running two sessions of the same user really hard because that lets the compositor try to grab the same resources as the other session.
Here's the script I had made, but I ended up just using a VM for a while since I wanted to also isolate installed packages and whatnot so it's barely enough to start gamescope.
#!/usr/bin/env python3
import os
import dbus
sysbus = dbus.SystemBus()
login = sysbus.get_object(
"org.freedesktop.login1",
"/org/freedesktop/login1"
)
manager = dbus.Interface(login, dbus_interface="org.freedesktop.login1.Manager")
manager.CreateSession(
1001, # u uid
os.getpid(), # u pid
"tv", # s service
"wayland", # s type
"user", # s class
"gamescope", # s desktop
"seat1", # s seat_id
0, # u vtnr
"", # s tty
"HDMI-A-1", # s display
False, # b remote
"tv", # s remote_user
"localhost", # s remote_host
[]
)
os.execve("/usr/bin/fish", ["--login"], { "XDG_SEAT": "seat1" })
Run it with
sudo systemd-run --system --scope
This will make systemd create a fully detached session from your user, so you can su to a different user, run PAM modules, start the XDG session.