3

With swaywm I'm almost multiseating (two people simultaneously using the same computer) with two keyboards, two mice and one GPU with two outputs.

At the start of the sway session, one nested X session is opened with Xephyr querying the localhosts XDMCP server (enabled in lightdm)

In short, these are the commands executed:

swaymsg "input abc:xyz:mouse map_to_output VGA-1"
swaymsg "seat seat1 attach abc:xyz:keyboard"
swaymsg "seat seat1 attach abc:xyz:mouse"
swaymsg "seat seat1 shortcuts_inhibitor enable"
Xephyr -query 127.0.0.1 -glamor -screen 1280x720 -noreset -no-host-grab -name Xephyr1 :1 &
sleep 3
swaymsg "[instance=Xephyr1] move window to output VGA-1"
swaymsg "[instance=Xephyr1] focus"
swaymsg "floating disable"

Xephyr successfully opens a new session, then it's moved to the proper monitor and one of the mice moves only there, and that's it.

Now, how could I capture the keyboard and mouse keypresses from the input devices attached to "seat1" only to that window/container regardless of focus?

Xephyr -keybd/-mouse driver settings don't work at all, neither does -seat.

I know how to multiseat with multiple GPUs and loginctl defining seats, but my goal is to multiseat with one GPU in any recent Linux distribution and not in old, patched ones.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
igorkattar
  • 71
  • 1
  • 5
  • Going to make a chroot environment (schroot/debootstrap) just to run Xephyr from Debian stretch, seems the last version of Xephyr support evdev drivers there. Sorry not to mention before but the host system is a Debian one. Any result I'll post here. – igorkattar Apr 29 '22 at 12:59

1 Answers1

1

Got it working in a chroot environment, not what I wanted but at least I'm not breaking the host system and at the same time not demanding too much additional resources, with a VM for example. Here what I did:

Installed schroot and debootstrap.

someuser:~$ sudo apt install debootstrap schroot

Added the following lines at the end of /etc/schroot/schroot.conf file to configure a chroot.

[stretch]
type=directory
description=Debian stretch
message-verbosity=quiet
directory=/opt/stretch
root-users=root
root-groups=root
users=someuser
groups=someuser
preserve-environment=true

Create the chroot directory and got the desired distribution with the needed packages

someuser:~$ sudo mkdir -p /opt/stretch
someuser:~$ sudo debootstrap --no-check-gpg --arch amd64 --variant=minbase --include=xserver-xephyr,libgl1-mesa-dri stretch /opt/stretch/ http://httpredir.debian.org/debian

Run the chrooted Xephyr with the line.

someuser:~$ schroot -c stretch -- Xephyr -query 127.0.0.1 -br -glamor -noreset -no-host-grab -keybd evdev,,device=/dev/input/event3,xkbmodel=pc105,xkblayout=br -mouse evdev,3,device=/dev/input/event2 -3button -zaphod -softCursor -output VGA-1 :2

Ok, Xephyr connects to the XDMCP server accepting only the defined keyboard and mouse defined.

Notice that I did not passed the devices with the -seat option, guess I need Udev for that and I cannot install it in a chroot environment.

igorkattar
  • 71
  • 1
  • 5
  • As you can notice this multiseat approach is not bound to Sway, some could adapt to any other window manager. – igorkattar Apr 29 '22 at 15:03