2021-11-26 06:41:56 +03:00
|
|
|
/**
|
|
|
|
* @brief session - UI session manager
|
|
|
|
*
|
|
|
|
* Runs the user's yutanirc or starts up a panel and desktop
|
|
|
|
* if they don't have one. Generally run by glogin.
|
|
|
|
*
|
|
|
|
* @copyright
|
2018-08-14 11:13:38 +03:00
|
|
|
* This file is part of ToaruOS and is released under the terms
|
|
|
|
* of the NCSA / University of Illinois License - see LICENSE.md
|
|
|
|
* Copyright (C) 2018 K. Lange
|
|
|
|
*/
|
2018-02-25 11:14:43 +03:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
|
|
|
int main(int argc, char * argv[]) {
|
2018-09-22 16:37:47 +03:00
|
|
|
|
|
|
|
char path[1024];
|
|
|
|
char * home = getenv("HOME");
|
|
|
|
if (home) {
|
|
|
|
sprintf(path, "%s/.yutanirc", home);
|
|
|
|
char * args[] = {path, NULL};
|
|
|
|
execvp(args[0], args);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fallback */
|
|
|
|
|
2018-02-25 11:14:43 +03:00
|
|
|
int _background_pid = fork();
|
|
|
|
if (!_background_pid) {
|
2018-11-19 15:14:39 +03:00
|
|
|
sprintf(path, "%s/Desktop", home);
|
|
|
|
chdir(path);
|
|
|
|
char * args[] = {"/bin/file-browser", "--wallpaper", NULL};
|
2018-02-25 11:14:43 +03:00
|
|
|
execvp(args[0], args);
|
|
|
|
}
|
|
|
|
|
2018-04-17 14:03:19 +03:00
|
|
|
int _panel_pid = fork();
|
|
|
|
if (!_panel_pid) {
|
2018-05-10 15:54:19 +03:00
|
|
|
char * args[] = {"/bin/panel", "--really", NULL};
|
2018-04-17 14:03:19 +03:00
|
|
|
execvp(args[0], args);
|
|
|
|
}
|
|
|
|
|
2018-02-25 11:14:43 +03:00
|
|
|
wait(NULL);
|
|
|
|
|
|
|
|
int pid;
|
|
|
|
do {
|
|
|
|
pid = waitpid(-1, NULL, 0);
|
|
|
|
} while ((pid > 0) || (pid == -1 && errno == EINTR));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|