aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-09-17 19:52:41 -0400
committerGitHub <noreply@github.com>2018-09-17 19:52:41 -0400
commit50a8758313ced79221c67890dde153a5884db76f (patch)
tree906836cb39e80a1fd6bfdb784b851e84ea55f2fc
parent8b112730ca8f6abeb3f941dc578b3598878e5480 (diff)
parent572dfcdba7694dc2221dcab2ed8b57615d59ed83 (diff)
Merge pull request #1250 from arandomhuman/wlr_session
Add support for WLR_SESSION env variable
-rw-r--r--backend/session/session.c21
-rw-r--r--docs/env_vars.md2
2 files changed, 20 insertions, 3 deletions
diff --git a/backend/session/session.c b/backend/session/session.c
index 3fcac3e3..041d8f83 100644
--- a/backend/session/session.c
+++ b/backend/session/session.c
@@ -66,10 +66,25 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_session *wlr_session_create(struct wl_display *disp) {
struct wlr_session *session = NULL;
- const struct session_impl **iter;
- for (iter = impls; !session && *iter; ++iter) {
- session = (*iter)->create(disp);
+ const char *env_wlr_session = getenv("WLR_SESSION");
+ if (env_wlr_session) {
+ if (!strcmp(env_wlr_session, "logind") || !strcmp(env_wlr_session, "systemd")) {
+ #if defined(WLR_HAS_SYSTEMD) || defined(WLR_HAS_ELOGIND)
+ session = session_logind.create(disp);
+ #else
+ wlr_log(WLR_ERROR, "wlroots is not compiled with logind support");
+ #endif
+ } else if (!strcmp(env_wlr_session, "direct")) {
+ session = session_direct.create(disp);
+ } else {
+ wlr_log(WLR_ERROR, "WLR_SESSION has an invalid value: %s", env_wlr_session);
+ }
+ } else {
+ const struct session_impl **iter;
+ for (iter = impls; !session && *iter; ++iter) {
+ session = (*iter)->create(disp);
+ }
}
if (!session) {
diff --git a/docs/env_vars.md b/docs/env_vars.md
index 34d91579..ef12e0b3 100644
--- a/docs/env_vars.md
+++ b/docs/env_vars.md
@@ -16,6 +16,8 @@ wlroots specific
of outputs
* *WLR_NO_HARDWARE_CURSORS*: set to 1 to use software cursors instead of
hardware cursors
+* *WLR_SESSION*: specifies the wlr\_session to be used (available sessions:
+ logind/systemd, direct)
rootston specific
------------------