seatd internally tracks arbitrary seats, but currently sends all clients to the default seat0.
Implementation idea:
- Add seat name to open request
- Execute an external program to evaluate if seat exists
- On device open, execute external program to evaluate if device belongs to seat.
This allows us to be device event system agnostic, and avoids racing with the clients device event implementation.
Alternative, simpler implementation idea that can be used as starting point
- Add seat name to open request
- Add an argument to seatd for list of available seats (later: configuration file, seatctl, or even just "allow any seat name but at most 16 simultaneous seats")
- Let a seat open any device if no other seat currently has it open - this way we do not yet need a filter mechanism
It also would be cool if libseat had an API to get seat of device.
Something like:
int libseat_get_device_seat(struct libseat *seat, const char *devpath, const char **seat_name);
That would allow programmatically getting seat without udev, elogind, systemd and all of that non-portable stuff.
What is the use-case?
logind uses the seat association from udev itself, but it does not appear to expose this over its API. libseat would have to integrate with udev to query the SEAT property of the device.
(seatd has not yet defined a way to associate a device with a seat.)