entrance: rearrange login with default system command

This commit is contained in:
Michael Bouchaud 2013-09-04 23:24:26 +02:00
parent d23571eee1
commit 6da13be704
4 changed files with 45 additions and 17 deletions

View File

@ -15,7 +15,7 @@ group "Entrance_Config" struct {
/* Commands executed when starting a session */
value "session_start" string: "/usr/bin/sessreg -a -l :0.0";
/* Command executed when login. Warning xsession must be set to 0 */
value "session_login" string: "/bin/bash -login $HOME/.xinitrc";
value "session_login" string: "/bin/bash -login";
/* Commands executed when exiting a session */
value "session_stop" string: "/usr/bin/sessreg -d -l :0.0";

View File

@ -33,6 +33,8 @@ entrance_history_init()
EET_LOGIN_ADD(icon.group, EET_T_STRING);
EET_LOGIN_ADD(background.path, EET_T_STRING);
EET_LOGIN_ADD(background.group, EET_T_STRING);
EET_LOGIN_ADD(ignore_last_session, EET_T_UCHAR);
#undef EET_LOGIN_ADD
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_History);
@ -109,6 +111,8 @@ entrance_history_push(const char *login, const char *session)
EINA_LIST_FOREACH(_entrance_history->history, l, el)
{
if (!strcmp(login, el->login))
{
if (!el->ignore_last_session)
{
if (!session)
{
@ -120,6 +124,7 @@ entrance_history_push(const char *login, const char *session)
eina_stringshare_replace(&el->session, session);
_history_update = EINA_TRUE;
}
}
break;
}
}

View File

@ -26,13 +26,11 @@ struct _Entrance_Login
const char *group;
} icon;
Entrance_Background background;
Eina_Bool ignore_last_session;
};
struct _Entrance_History
{
const char *theme;
Eina_Bool vkbdscreen;
Entrance_Background background;
Eina_List *history;
};

View File

@ -335,8 +335,12 @@ entrance_session_login(const char *session, Eina_Bool push)
}
if (push) entrance_history_push(pwd->pw_name, session);
cmd = _entrance_session_find_command(pwd->pw_dir, session);
PT("launching session ");
fprintf(stderr, "%s for user %s\n", session, _login);
if (!cmd)
{
PT("Error !!! No command to launch, can't open a session :'(\n");
return ECORE_CALLBACK_CANCEL;
}
PT("launching session %s for user %s\n", cmd, _login);
_entrance_session_run(pwd, cmd, buf);
return ECORE_CALLBACK_CANCEL;
}
@ -358,10 +362,31 @@ _entrance_session_find_command(const char *path, const char *session)
}
}
}
snprintf(buf, sizeof(buf), "%s/%s", path, ".Xsession");
snprintf(buf, sizeof(buf), "%s/%s",
path, ".xinitrc");
if (ecore_file_can_exec(buf))
{
snprintf(buf, sizeof(buf), "%s %s/%s",
entrance_config->command.session_login,
path, ".xinitrc");
return eina_stringshare_add(buf);
return (entrance_config->command.session_login);
}
snprintf(buf, sizeof(buf), "%s/%s",
path, ".Xsession");
if (ecore_file_can_exec(buf))
{
snprintf(buf, sizeof(buf), "%s %s/%s",
entrance_config->command.session_login,
path, ".Xsession");
return eina_stringshare_add(buf);
}
if (ecore_file_exists("/etc/X11/xinit/xinitrc"))
{
snprintf(buf, sizeof(buf), "%s /etc/X11/xinit/xinitrc",
entrance_config->command.session_login);
return eina_stringshare_add(buf);
}
return NULL;
}
char *