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 */ /* Commands executed when starting a session */
value "session_start" string: "/usr/bin/sessreg -a -l :0.0"; value "session_start" string: "/usr/bin/sessreg -a -l :0.0";
/* Command executed when login. Warning xsession must be set to 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 */ /* Commands executed when exiting a session */
value "session_stop" string: "/usr/bin/sessreg -d -l :0.0"; 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(icon.group, EET_T_STRING);
EET_LOGIN_ADD(background.path, EET_T_STRING); EET_LOGIN_ADD(background.path, EET_T_STRING);
EET_LOGIN_ADD(background.group, EET_T_STRING); EET_LOGIN_ADD(background.group, EET_T_STRING);
EET_LOGIN_ADD(ignore_last_session, EET_T_UCHAR);
#undef EET_LOGIN_ADD #undef EET_LOGIN_ADD
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_History); EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_History);
@ -110,15 +112,18 @@ entrance_history_push(const char *login, const char *session)
{ {
if (!strcmp(login, el->login)) if (!strcmp(login, el->login))
{ {
if (!session) if (!el->ignore_last_session)
{ {
eina_stringshare_del(el->session); if (!session)
el->session = NULL; {
} eina_stringshare_del(el->session);
else if (el->session && strcmp(session, el->session)) el->session = NULL;
{ }
eina_stringshare_replace(&el->session, session); else if (el->session && strcmp(session, el->session))
_history_update = EINA_TRUE; {
eina_stringshare_replace(&el->session, session);
_history_update = EINA_TRUE;
}
} }
break; break;
} }

View File

@ -26,13 +26,11 @@ struct _Entrance_Login
const char *group; const char *group;
} icon; } icon;
Entrance_Background background; Entrance_Background background;
Eina_Bool ignore_last_session;
}; };
struct _Entrance_History struct _Entrance_History
{ {
const char *theme;
Eina_Bool vkbdscreen;
Entrance_Background background;
Eina_List *history; 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); if (push) entrance_history_push(pwd->pw_name, session);
cmd = _entrance_session_find_command(pwd->pw_dir, session); cmd = _entrance_session_find_command(pwd->pw_dir, session);
PT("launching session "); if (!cmd)
fprintf(stderr, "%s for user %s\n", session, _login); {
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); _entrance_session_run(pwd, cmd, buf);
return ECORE_CALLBACK_CANCEL; 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)) if (ecore_file_can_exec(buf))
return eina_stringshare_add(buf); {
return (entrance_config->command.session_login); snprintf(buf, sizeof(buf), "%s %s/%s",
entrance_config->command.session_login,
path, ".xinitrc");
return eina_stringshare_add(buf);
}
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 * char *