entrance: use Xsession script to launch the session

This commit is contained in:
Michael Bouchaud 2014-05-05 20:20:33 +00:00
parent 74ebe7265c
commit 6d93384f12
5 changed files with 14 additions and 22 deletions

View File

@ -12,8 +12,10 @@ group "Entrance_Config" struct {
value "xauth_file" string: "/var/run/entrance.auth";
/* Commands executed when starting a session */
/* Commands executed before starting a session */
value "session_start" string: "/usr/bin/sessreg -a -l :0.0";
/* Commands executed to launch a session */
value "session_start" string: "/etc/entrance/Xsession";
/* Commands executed when exiting a session */
value "session_stop" string: "/usr/bin/sessreg -d -l :0.0";
@ -35,8 +37,7 @@ 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,
* 2 = pass window manager choice to system command */
* 1 = use system and xdg desktop files, 0 = only system command */
value "xsessions" uchar: 1;
/** Bool to determine if entrance must autologin user when X start

View File

@ -19,13 +19,14 @@ _defaults_set(Entrance_Config *config)
config->command.xauth_path = eina_stringshare_add("/usr/bin/xauth");
config->command.xauth_file = eina_stringshare_add("/var/run/entrance.auth");
config->command.session_start = eina_stringshare_add("/usr/bin/sessreg -a -l :0.0" );
config->command.session_login = eina_stringshare_add(SYSTEM_CONFIG_DIR"/entrance/Xsession");
config->command.session_stop = eina_stringshare_add("/usr/bin/sessreg -d -l :0.0");
config->command.shutdown = eina_stringshare_add("/usr/bin/shutdown -h now");
config->command.reboot = eina_stringshare_add("/usr/bin/shutdown -r now");
config->command.suspend = eina_stringshare_add("/usr/sbin/suspend");
config->daemonize = EINA_TRUE;
config->numlock = EINA_FALSE;
config->xsessions = ENTRANCE_SESSION_DESKTOP_NONE;
config->xsessions = EINA_TRUE;
config->autologin = EINA_FALSE;
config->custom_conf = EINA_FALSE;
config->userlogin = eina_stringshare_add("mylogintouse");
@ -123,6 +124,7 @@ _config_free(Entrance_Config *config)
eina_stringshare_del(config->command.xauth_path);
eina_stringshare_del(config->command.xauth_file);
eina_stringshare_del(config->command.session_start);
eina_stringshare_del(config->command.session_login);
eina_stringshare_del(config->command.session_stop);
eina_stringshare_del(config->command.shutdown);
eina_stringshare_del(config->command.reboot);
@ -151,6 +153,7 @@ entrance_config_init()
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "xauth_path", command.xauth_path, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "xauth_file", command.xauth_file, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "session_start", command.session_start, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "session_login", command.session_login, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "session_stop", command.session_stop, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "shutdown", command.shutdown, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "reboot", command.reboot, EET_T_STRING);

View File

@ -5,13 +5,6 @@
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;
@ -22,6 +15,7 @@ struct _Entrance_Config
const char *xauth_path;
const char *xauth_file;
const char *session_start;
const char *session_login;
const char *session_stop;
const char *shutdown;
const char *reboot;
@ -37,7 +31,7 @@ struct _Entrance_Config
const char *path;
const char *group;
} bg;
unsigned char xsessions;
Eina_Bool xsessions;
Eina_Bool daemonize;
Eina_Bool numlock;
Eina_Bool autologin;

View File

@ -26,7 +26,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 != ENTRANCE_SESSION_DESKTOP_NONE)
if (entrance_config->xsessions)
{
PT("Sending xsessions\n");
eev.type = ENTRANCE_EVENT_XSESSIONS;

View File

@ -181,8 +181,8 @@ _entrance_session_run(struct passwd *pwd, const char *cmd, const char *cookie)
snprintf(buf, sizeof(buf), PACKAGE_BIN_DIR"/entrance_ck_launch %s > %s/.entrance_session.log 2>&1",
cmd, pwd->pw_dir);
#else
snprintf(buf, sizeof(buf), "%s > %s/.entrance_session.log 2>&1",
cmd, pwd->pw_dir);
snprintf(buf, sizeof(buf), "%s %s > %s/.entrance_session.log 2>&1",
entrance_config->command.session_login, cmd, pwd->pw_dir);
#endif
PT("Executing: %s --login -c %s \n", pwd->pw_shell, buf);
execle(pwd->pw_shell, pwd->pw_shell, "--login", "-c", buf, NULL, env);
@ -374,16 +374,10 @@ _entrance_session_find_command(const char *path, const char *session)
if (!strcmp(xsession->name, session))
{
if (xsession->command)
{
if (entrance_config->xsessions
== ENTRANCE_SESSION_DESKTOP_FILE_CMD_ARGS)
break;
else
return xsession->command;
}
}
}
}
snprintf(buf, sizeof(buf), "%s/%s",
path, ".xinitrc");
if (ecore_file_can_exec(buf))