Posted on :: 383 Words :: Tags: , , :: Source Code

So you know, sway has what it calls multiseat. This is different from Wayland multiseat stuff. A seat in sway is a set of input-devices with independent window focus.

This is amazing for e.g. pair-programming use cases.

But can we do gaming with that?

Software

Software used in this:

sway version 1.11

steam 1.0.0.85-1

flatpak com.valvesoftware.Steam 1.0.0.84

The X.Org Foundation Xwayland Version 24.1.8 (12401008)

Openbox 3.6.1

Setting up multiseat

List the current seats with swaymsg -t get_seats. Output should look something like this:

Seat: seat0
  Capabilities: 3
  Devices:
    [keyboard one]
    [keyboard two]
    [mouse one]
    [mouse two]
    [various other things like the powerbutton]

Create a second seat and attach the second set of input devices with

swaymsg -- seat seat1 attach [keyboard two]
swaymsg -- seat seat1 attach [mouse two]

Using the "Identifier" respectively. (identifiers can be obtained from swaymsg -t get_input). If your device has multiple input devices associated, ensure you assign all of them to the second seat.

Afterward it should look vaguely like this:

Seat: seat0
  Capabilities: 3
  Devices:
    [keyboard one]
    [mouse one]
    [various other things like the powerbutton]
Seat: seat1
  Capabilities: 3
  Devices:
    [keyboard two]
    [mouse two]

You should now already see two sets of cursors, and be able to use them as normal, at the same time, in all Wayland native windows.

If you only need this for e.g. pair programming, you are done!

So about steam

The game we will be playing is Farlight 84. No particular reason apart from "that's what we wanted to play".

To get this to work at all, we need to run two instances of steam. Very simple solution: Run one directly, and run one in Flatpak.

This immediatly surfaced a problem: Steam runs as a Xwayland window. And X can not, like at all, deal with having multiple cursors. It just adds them together. If steam was running natively on Wayland, this would have just worked.

So we need to launch our second steam on a separate instance of Xwayland. Luckily that is very simple, just:

Xwayland :3

Assign the resulting Xwayland window to a monitor, and make it full-screen. We now can run applications on this x server by setting the DISPLAY variable, like DISPLAY=:3 $command

So to get any amount of control on that window, we start an openbox (very simple x window manager) on it.

DISPLAY=:3 openbox-session

And now: launch steam with DISPLAY=:3 flatpak run com.valvesoftware.Steam. Install your game (or copy/bindmount/cow reflink your steam libary over to the second instance ).

Audio

The only thing left to do is audio. Plug in a second set of headphones, and use helvum to arrange the audio routing to ensure that the right game goes to the right headphones.