yoz pushed a commit to branch master.

http://git.enlightenment.org/misc/entrance.git/commit/?id=b51edc9c1cf1ad751b7e59510941e6038fb0c197

commit b51edc9c1cf1ad751b7e59510941e6038fb0c197
Author: Michael Bouchaud <y...@efl.so>
Date:   Fri Nov 8 00:10:15 2013 +0100

    entrance: Let user choose WM/DE by his choice and pass it as parameter to 
the system session command
---
 data/entrance.conf            |  3 ++-
 src/daemon/entrance_config.c  |  2 +-
 src/daemon/entrance_config.h  |  9 ++++++++-
 src/daemon/entrance_server.c  |  2 +-
 src/daemon/entrance_session.c | 18 +++++++++++++++++-
 5 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/data/entrance.conf b/data/entrance.conf
index 9c83d10..e138625 100644
--- a/data/entrance.conf
+++ b/data/entrance.conf
@@ -35,7 +35,8 @@ group "Entrance_Config" struct {
 
     /** Bool to determine if entrance could use the xdg desktop files and
      * determine the command to use
-     *  1 = desktop_file_cmd, 0 = session_login */
+     * 1 = desktop_file_cmd, 0 = session_login,
+     * 2 = pass window manager choice to session_login command */
     value "xsessions" uchar: 1;
 
     /** Bool to determine if entrance must autologin user when X start
diff --git a/src/daemon/entrance_config.c b/src/daemon/entrance_config.c
index b1aa91c..4591aa5 100644
--- a/src/daemon/entrance_config.c
+++ b/src/daemon/entrance_config.c
@@ -25,7 +25,7 @@ _defaults_set(Entrance_Config *config)
    config->command.suspend = eina_stringshare_add("/usr/sbin/suspend");
    config->daemonize = EINA_TRUE;
    config->numlock = EINA_FALSE;
-   config->xsessions = EINA_FALSE;
+   config->xsessions = ENTRANCE_SESSION_DESKTOP_NONE;
    config->autologin = EINA_FALSE;
    config->custom_conf = EINA_FALSE;
    config->userlogin = eina_stringshare_add("mylogintouse");
diff --git a/src/daemon/entrance_config.h b/src/daemon/entrance_config.h
index 4372a4d..fb64973 100644
--- a/src/daemon/entrance_config.h
+++ b/src/daemon/entrance_config.h
@@ -5,6 +5,13 @@
 
 typedef struct _Entrance_Config Entrance_Config;
 
+typedef enum
+{
+   ENTRANCE_SESSION_DESKTOP_NONE = 0,
+   ENTRANCE_SESSION_DESKTOP_FILE_CMD = 1,
+   ENTRANCE_SESSION_DESKTOP_FILE_CMD_ARGS = 2
+} Entrance_Session_Type;
+
 struct _Entrance_Config
 {
    const char *session_path;
@@ -30,9 +37,9 @@ struct _Entrance_Config
         const char *path;
         const char *group;
      } bg;
+   unsigned char xsessions;
    Eina_Bool daemonize;
    Eina_Bool numlock;
-   Eina_Bool xsessions;
    Eina_Bool autologin;
    Eina_Bool custom_conf;
    Eina_Bool vkbd_enabled;
diff --git a/src/daemon/entrance_server.c b/src/daemon/entrance_server.c
index db6f689..cc8b43b 100644
--- a/src/daemon/entrance_server.c
+++ b/src/daemon/entrance_server.c
@@ -25,7 +25,7 @@ _entrance_server_add(void *data EINA_UNUSED, int type 
EINA_UNUSED, void *event E
    eev.type = ENTRANCE_EVENT_ACTIONS;
    eev.event.actions.actions = entrance_action_get();
    entrance_event_send(&eev);
-   if (entrance_config->xsessions)
+   if (entrance_config->xsessions != ENTRANCE_SESSION_DESKTOP_NONE)
      {
         PT("Sending xsessions\n");
         eev.type = ENTRANCE_EVENT_XSESSIONS;
diff --git a/src/daemon/entrance_session.c b/src/daemon/entrance_session.c
index e5fe3a0..db97edd 100644
--- a/src/daemon/entrance_session.c
+++ b/src/daemon/entrance_session.c
@@ -367,7 +367,11 @@ _entrance_session_find_command(const char *path, const 
char *session)
                {
                   if (xsession->command)
                     {
-                       return xsession->command;
+                       if (entrance_config->xsessions
+                           == ENTRANCE_SESSION_DESKTOP_FILE_CMD_ARGS)
+                         break;
+                       else
+                         return xsession->command;
                     }
                }
           }
@@ -376,16 +380,28 @@ _entrance_session_find_command(const char *path, const 
char *session)
             path, ".xinitrc");
    if (ecore_file_can_exec(buf))
      {
+        if (xsession)
+          snprintf(buf, sizeof(buf), "%s/%s %s",
+                   path, ".xinitrc", xsession->command);
         return eina_stringshare_add(buf);
      }
    snprintf(buf, sizeof(buf), "%s/%s",
             path, ".Xsession");
    if (ecore_file_can_exec(buf))
      {
+        if (xsession)
+          snprintf(buf, sizeof(buf), "%s/%s %s",
+                   path, ".Xsession", xsession->command);
         return eina_stringshare_add(buf);
      }
    if (ecore_file_exists("/etc/X11/xinit/xinitrc"))
      {
+        if (xsession)
+          {
+             snprintf(buf, sizeof(buf), "/etc/X11/xinit/xinitrc %s",
+                      xsession->command);
+             return eina_stringshare_add(buf);
+          }
         return eina_stringshare_add("/etc/X11/xinit/xinitrc");
      }
    return NULL;

-- 


Reply via email to