entrance: Let user choose WM/DE by his choice and pass it as parameter to the system session command

This commit is contained in:
Michael Bouchaud 2013-11-08 00:10:15 +01:00
parent 6f9dd39de7
commit b51edc9c1c
5 changed files with 29 additions and 5 deletions

View File

@ -35,7 +35,8 @@ group "Entrance_Config" struct {
/** Bool to determine if entrance could use the xdg desktop files and /** Bool to determine if entrance could use the xdg desktop files and
* determine the command to use * 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; value "xsessions" uchar: 1;
/** Bool to determine if entrance must autologin user when X start /** Bool to determine if entrance must autologin user when X start

View File

@ -25,7 +25,7 @@ _defaults_set(Entrance_Config *config)
config->command.suspend = eina_stringshare_add("/usr/sbin/suspend"); config->command.suspend = eina_stringshare_add("/usr/sbin/suspend");
config->daemonize = EINA_TRUE; config->daemonize = EINA_TRUE;
config->numlock = EINA_FALSE; config->numlock = EINA_FALSE;
config->xsessions = EINA_FALSE; config->xsessions = ENTRANCE_SESSION_DESKTOP_NONE;
config->autologin = EINA_FALSE; config->autologin = EINA_FALSE;
config->custom_conf = EINA_FALSE; config->custom_conf = EINA_FALSE;
config->userlogin = eina_stringshare_add("mylogintouse"); config->userlogin = eina_stringshare_add("mylogintouse");

View File

@ -5,6 +5,13 @@
typedef struct _Entrance_Config Entrance_Config; 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 struct _Entrance_Config
{ {
const char *session_path; const char *session_path;
@ -30,9 +37,9 @@ struct _Entrance_Config
const char *path; const char *path;
const char *group; const char *group;
} bg; } bg;
unsigned char xsessions;
Eina_Bool daemonize; Eina_Bool daemonize;
Eina_Bool numlock; Eina_Bool numlock;
Eina_Bool xsessions;
Eina_Bool autologin; Eina_Bool autologin;
Eina_Bool custom_conf; Eina_Bool custom_conf;
Eina_Bool vkbd_enabled; Eina_Bool vkbd_enabled;

View File

@ -25,7 +25,7 @@ _entrance_server_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event E
eev.type = ENTRANCE_EVENT_ACTIONS; eev.type = ENTRANCE_EVENT_ACTIONS;
eev.event.actions.actions = entrance_action_get(); eev.event.actions.actions = entrance_action_get();
entrance_event_send(&eev); entrance_event_send(&eev);
if (entrance_config->xsessions) if (entrance_config->xsessions != ENTRANCE_SESSION_DESKTOP_NONE)
{ {
PT("Sending xsessions\n"); PT("Sending xsessions\n");
eev.type = ENTRANCE_EVENT_XSESSIONS; eev.type = ENTRANCE_EVENT_XSESSIONS;

View File

@ -367,7 +367,11 @@ _entrance_session_find_command(const char *path, const char *session)
{ {
if (xsession->command) 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"); path, ".xinitrc");
if (ecore_file_can_exec(buf)) if (ecore_file_can_exec(buf))
{ {
if (xsession)
snprintf(buf, sizeof(buf), "%s/%s %s",
path, ".xinitrc", xsession->command);
return eina_stringshare_add(buf); return eina_stringshare_add(buf);
} }
snprintf(buf, sizeof(buf), "%s/%s", snprintf(buf, sizeof(buf), "%s/%s",
path, ".Xsession"); path, ".Xsession");
if (ecore_file_can_exec(buf)) if (ecore_file_can_exec(buf))
{ {
if (xsession)
snprintf(buf, sizeof(buf), "%s/%s %s",
path, ".Xsession", xsession->command);
return eina_stringshare_add(buf); return eina_stringshare_add(buf);
} }
if (ecore_file_exists("/etc/X11/xinit/xinitrc")) 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 eina_stringshare_add("/etc/X11/xinit/xinitrc");
} }
return NULL; return NULL;