From f0d03fb8921b79c776d0fe9abedced78302c3c06 Mon Sep 17 00:00:00 2001 From: Ryan Walklin Date: Thu, 25 Jun 2020 22:56:56 +1200 Subject: Implement logind session SetType method to change session type to wayland --- backend/session/logind.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'backend') diff --git a/backend/session/logind.c b/backend/session/logind.c index 00babcae..317b179f 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -241,6 +241,24 @@ static bool take_control(struct logind_session *session) { return ret >= 0; } +static bool set_type(struct logind_session *session) { + int ret; + sd_bus_message *msg = NULL; + sd_bus_error error = SD_BUS_ERROR_NULL; + + ret = sd_bus_call_method(session->bus, "org.freedesktop.login1", + session->path, "org.freedesktop.login1.Session", "SetType", + &error, &msg, "s", "wayland"); + if (ret < 0) { + wlr_log(WLR_ERROR, "Failed to set session type for session: %s", + error.message); + } + + sd_bus_error_free(&error); + sd_bus_message_unref(msg); + return ret >= 0; +} + static void release_control(struct logind_session *session) { int ret; sd_bus_message *msg = NULL; @@ -819,6 +837,11 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) { } } + if (!set_type(session)) { + // Not fatal + wlr_log(WLR_INFO, "Failed to set logind session type to wayland"); + } + wlr_log(WLR_INFO, "Successfully loaded logind session"); session->base.impl = &session_logind; -- cgit v1.2.3