Add a display server and graphical user interface #38

Merged
apio merged 103 commits from display-server into main 2023-09-20 18:49:21 +00:00
2 changed files with 10 additions and 2 deletions
Showing only changes of commit 774177ba1f - Show all commits

3
base/etc/user/00-gclient Normal file
View File

@ -0,0 +1,3 @@
Name=gclient
Description=Sample user application.
Command=/usr/bin/gclient

View File

@ -7,6 +7,7 @@
#include <os/File.h>
#include <os/LocalServer.h>
#include <os/Process.h>
#include <os/Security.h>
#include <pwd.h>
#include <stdlib.h>
#include <string.h>
@ -19,6 +20,8 @@ Result<int> luna_main(int argc, char** argv)
{
srand((unsigned)time(NULL));
TRY(os::Security::pledge("stdio rpath wpath cpath unix proc exec tty id", NULL));
StringView socket_path = "/tmp/wind.sock";
StringView user;
@ -74,8 +77,8 @@ Result<int> luna_main(int argc, char** argv)
auto server = TRY(os::LocalServer::create(socket_path, false));
TRY(server->listen(20));
StringView args[] = { "/usr/bin/gclient"_sv };
TRY(os::Process::spawn("/usr/bin/gclient"_sv, Slice<StringView> { args, 1 }, false));
StringView args[] = { "/usr/bin/init"_sv, "--user"_sv };
TRY(os::Process::spawn("/usr/bin/init"_sv, Slice<StringView> { args, 2 }, false));
ui::Color background = ui::BLACK;
@ -85,6 +88,8 @@ Result<int> luna_main(int argc, char** argv)
Vector<os::LocalServer::Client> clients;
TRY(os::Security::pledge("stdio rpath unix", NULL));
while (1)
{
screen.canvas().fill(background);