~bmiww


#23 Opening seat - select logind session 8 months ago

Comment by ~bmiww on ~kennylevinsen/seatd

Thanks for the seatd pointer, I'll explore it. After your comment - i spent a bunch of time running in circles questioning environment variables - you're absolutely right, it is just an env var, so i'm finally asking the real questions - why doesn't this work.

If i change the var directly in the device terminal - it has a definite effect, i can force it not to find a seat by setting it to a value of one of the ssh sessions. But if i set it inside of the ssh sessions - sure - printing the env var out - it seems to be correct, but it doesn't end up finding the seat.

So far - I've narrowed the issue down to the distribution package. If i build the lib myself - it works as expected, but while using the prebuilt package - the ssh awkwardness happens. Any case - at least i got on the right track of finding where this goes wrong.

Thanks, and sorry for the bother! If i get the patience - i'll debug where exactly the archlinux-arm package goes wrong. Will close this ticky, since it does seem a bit pointless to wrap an env var with another :).

#23 Opening seat - select logind session 8 months ago

on ~kennylevinsen/seatd

On 5/7/24 12:46 AM, ~bmiww wrote:

If someone knows of a way to set the XDG_SESSION_ID - i'm also all ears, wouldn't need this patchiness then, i've had no luck digging it up.

It's just an environment variable which you'd set the same way as the XDG_SESSION_ID_OVERRIDE variable you add here.

XDG_SESSION_ID=1234 ./mycompositor

Alternatively, if seatd is running things will just work as seatd grants any eligible user access to the current VT if it is not already in use. If you don't have it running as a service with the seat group set up, you can just do sudo seatd -u YOUR_USERNAME & to run it as a one-off granting only your user access.

It can run in parallel with logind for debugging/development. They only trample on each other if you try to take devices through both in parallel.

#23 Opening seat - select logind session 8 months ago

Ticket created by ~bmiww on ~kennylevinsen/seatd

Use case: mobile/embedded device development via ssh. Running a drm/input aware process in an ssh session to not have to fiddle with extra keyboards on a linux phone or tablet.

Currently have been running this lazy patch, if the idea isn't too far out there, I'll have a think on how to integrate this in a nicer way for possible merginess.

If someone knows of a way to set the XDG_SESSION_ID - i'm also all ears, wouldn't need this patchiness then, i've had no luck digging it up.

From 3ddf5ef9bab88645f7a8395b69d3b29644930aa2 Mon Sep 17 00:00:00 2001
From: bmiww <bmiww@bky.one>
Date: Tue, 7 May 2024 00:30:02 +0200
Subject: [PATCH] Allow overriding XDG_SESSION_ID	when getting logind
 session

---
 libseat/backend/logind.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libseat/backend/logind.c b/libseat/backend/logind.c
index aec4ed2..ee8e2fb 100644
--- a/libseat/backend/logind.c
+++ b/libseat/backend/logind.c
@@ -622,8 +622,15 @@ out:
 
 static int get_display_session(char **session_id) {
 	assert(session_id != NULL);
-	char *xdg_session_id = getenv("XDG_SESSION_ID");
+
 	int ret;
+	char *xdg_session_id_override = getenv("XDG_SESSION_ID_OVERRIDE");
+	char *xdg_session_id;
+	if (xdg_session_id_override) {
+		xdg_session_id = xdg_session_id_override;
+	} else {
+		xdg_session_id = getenv("XDG_SESSION_ID");
+	}
 
 	if (xdg_session_id) {
 		// This just checks whether the supplied session ID is valid
-- 
2.43.0