mirror of https://github.com/fairyglade/ly.git
initial work on wayland
This commit is contained in:
parent
c5f0d28481
commit
060184bcb4
|
@ -34,6 +34,7 @@
|
||||||
/* paths */
|
/* paths */
|
||||||
#define LY_PATH "/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/env"
|
#define LY_PATH "/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/env"
|
||||||
#define LY_PATH_XSESSIONS "/usr/share/xsessions"
|
#define LY_PATH_XSESSIONS "/usr/share/xsessions"
|
||||||
|
#define LY_PATH_WSESSIONS "/usr/share/wayland-sessions"
|
||||||
|
|
||||||
/* console */
|
/* console */
|
||||||
#define LY_CONSOLE_DEV "/dev/console"
|
#define LY_CONSOLE_DEV "/dev/console"
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#define LY_XSESSION_EXEC "Exec="
|
#define LY_XSESSION_EXEC "Exec="
|
||||||
#define LY_XSESSION_NAME "Name="
|
#define LY_XSESSION_NAME "Name="
|
||||||
|
|
||||||
/* returns a list containing all the DE for all the display servers */
|
// searches a folder
|
||||||
struct delist_t* list_de(void)
|
void get_desktops(char* sessions_dir, struct delist_t* list, int* remote_count, short x)
|
||||||
{
|
{
|
||||||
/* xsession */
|
/* xsession */
|
||||||
FILE* file;
|
FILE* file;
|
||||||
|
@ -22,18 +22,17 @@ struct delist_t* list_de(void)
|
||||||
char path[LY_LIM_PATH];
|
char path[LY_LIM_PATH];
|
||||||
char* name;
|
char* name;
|
||||||
char* command;
|
char* command;
|
||||||
/* de list */
|
int count = *remote_count;
|
||||||
int count = 2;
|
|
||||||
struct delist_t* list = init_list(count);
|
|
||||||
/* reads xorg's desktop environments entries */
|
/* reads xorg's desktop environments entries */
|
||||||
dir = opendir(LY_PATH_XSESSIONS);
|
dir = opendir(sessions_dir);
|
||||||
|
|
||||||
/* exits if the folder can't be read */
|
/* exits if the folder can't be read */
|
||||||
if(!dir)
|
if(!dir)
|
||||||
{
|
{
|
||||||
error_print(LY_ERR_DELIST);
|
error_print(LY_ERR_DELIST);
|
||||||
end_list(list, count);
|
end_list(list, count);
|
||||||
return NULL;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cycles through the folder */
|
/* cycles through the folder */
|
||||||
|
@ -46,7 +45,7 @@ struct delist_t* list_de(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* opens xsession file */
|
/* opens xsession file */
|
||||||
snprintf(path, sizeof(path), "%s/%s", LY_PATH_XSESSIONS,
|
snprintf(path, sizeof(path), "%s/%s", sessions_dir,
|
||||||
dir_info->d_name);
|
dir_info->d_name);
|
||||||
file = fopen(path, "r");
|
file = fopen(path, "r");
|
||||||
|
|
||||||
|
@ -77,12 +76,24 @@ struct delist_t* list_de(void)
|
||||||
list->props = realloc(list->props,
|
list->props = realloc(list->props,
|
||||||
(count + 1) * (sizeof * (list->props)));
|
(count + 1) * (sizeof * (list->props)));
|
||||||
list->props[count].cmd = command;
|
list->props[count].cmd = command;
|
||||||
list->props[count].type = xorg;
|
list->props[count].type = x ? xorg : wayland;
|
||||||
++count;
|
++count;
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
*remote_count = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* returns a list containing all the DE for all the display servers */
|
||||||
|
struct delist_t* list_de(void)
|
||||||
|
{
|
||||||
|
/* de list */
|
||||||
|
int count = 2;
|
||||||
|
struct delist_t* list = init_list(count);
|
||||||
|
|
||||||
|
get_desktops(LY_PATH_XSESSIONS, list, &count, true);
|
||||||
|
get_desktops(LY_PATH_WSESSIONS, list, &count, false);
|
||||||
end_list(list, count);
|
end_list(list, count);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -495,7 +495,13 @@ int xinitrc)
|
||||||
void launch_wayland(struct passwd* pwd, pam_handle_t* pam_handle,
|
void launch_wayland(struct passwd* pwd, pam_handle_t* pam_handle,
|
||||||
const char* de_command)
|
const char* de_command)
|
||||||
{
|
{
|
||||||
exit(EXIT_FAILURE);
|
char cmd[32];
|
||||||
|
extern char** environ;
|
||||||
|
char* argv[] = {pwd->pw_shell, "-l", "-c", cmd, NULL};
|
||||||
|
snprintf(cmd, 32, "exec %s", de_command);
|
||||||
|
reset_terminal(pwd);
|
||||||
|
execve(pwd->pw_shell, argv, environ);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void launch_shell(struct passwd* pwd, pam_handle_t* pam_handle)
|
void launch_shell(struct passwd* pwd, pam_handle_t* pam_handle)
|
||||||
|
|
Loading…
Reference in New Issue