[PATCH v6 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable
nerdopolis
bluescreen_avenger at verizon.net
Wed Jan 24 03:15:43 UTC 2018
This will allow the seat to be set by the environment as pam_systemd typically
sets the XDG_SEAT variable
---
compositor/main.c | 2 +-
libweston/compositor-drm.c | 5 +++++
man/weston-drm.man | 7 +++++--
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/compositor/main.c b/compositor/main.c
index 7feb4cb0..72ae14b9 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -563,7 +563,7 @@ usage(int error_code)
#if defined(BUILD_DRM_COMPOSITOR)
fprintf(stderr,
"Options for drm-backend.so:\n\n"
- " --seat=SEAT\t\tThe seat that weston should run on\n"
+ " --seat=SEAT\t\tThe seat that weston should run on, instead of the seat defined in XDG_SEAT\n"
" --tty=TTY\t\tThe tty to use\n"
" --drm-device=CARD\tThe DRM device to use, e.g. \"card0\".\n"
" --use-pixman\t\tUse the pixman (CPU) renderer\n"
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 3eda70f3..5585944e 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -4036,8 +4036,13 @@ drm_backend_create(struct weston_compositor *compositor,
struct udev_device *drm_device;
struct wl_event_loop *loop;
const char *seat_id = default_seat;
+ const char *session_seat;
int ret;
+ session_seat = getenv("XDG_SEAT");
+ if (session_seat)
+ seat_id = session_seat;
+
weston_log("initializing drm backend\n");
b = zalloc(sizeof *b);
diff --git a/man/weston-drm.man b/man/weston-drm.man
index 75d79021..883395f2 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -101,8 +101,8 @@ status. For example, use
\fB\-\-seat\fR=\fIseatid\fR
Use graphics and input devices designated for seat
.I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in the environment variable
+. BR XDG_SEAT " , and If neither is specifed, seat0 will be assumed."
.TP
\fB\-\-tty\fR=\fIx\fR
Launch Weston on tty
@@ -124,6 +124,9 @@ The file descriptor (integer) where
.B weston-launch
is listening. Automatically set by
.BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat that Weston will start on.
.
.\" ***************************************************************
.SH "SEE ALSO"
--
2.14.1
More information about the wayland-devel
mailing list