Support graphical session logout.
You can log out by exiting the terminal for now, this will later be "by exiting the wallpaper application" or something to that effect, and will be triggered by an on-screen button or keybinding. [ci skip]
This commit is contained in:
parent
cea692b577
commit
08f6a66e6a
@ -1,34 +1,38 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <syscall.h>
|
||||
|
||||
volatile int _end_session = 0;
|
||||
|
||||
void sig_int(int sig) {
|
||||
_end_session = 1;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
/* Starts a graphical session and then spins waiting for a kill (logout) signal */
|
||||
syscall_signal(2, sig_int);
|
||||
|
||||
if (!fork()) {
|
||||
int _wallpaper_pid = fork();
|
||||
if (!_wallpaper_pid) {
|
||||
char * args[] = {"/bin/wallpaper", NULL};
|
||||
execve(args[0], args, NULL);
|
||||
}
|
||||
if (!fork()) {
|
||||
int _panel_pid = fork();
|
||||
if (!_panel_pid) {
|
||||
char * args[] = {"/bin/panel", NULL};
|
||||
execve(args[0], args, NULL);
|
||||
}
|
||||
if (!fork()) {
|
||||
int _terminal_pid = fork();
|
||||
if (!_terminal_pid) {
|
||||
char * args[] = {"/bin/terminal", NULL};
|
||||
execve(args[0], args, NULL);
|
||||
}
|
||||
|
||||
syscall_wait(_terminal_pid);
|
||||
|
||||
printf("Terminal has exited. Sending kill signals to %d and %d.\n", _wallpaper_pid, _panel_pid);
|
||||
|
||||
syscall_send_signal(_wallpaper_pid, 2);
|
||||
syscall_send_signal(_panel_pid, 2);
|
||||
|
||||
printf("Waiting on wallpaper.\n");
|
||||
syscall_wait(_wallpaper_pid);
|
||||
|
||||
printf("Waiting on panel.\n");
|
||||
syscall_wait(_panel_pid);
|
||||
|
||||
while (!_end_session) {
|
||||
syscall_yield();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user