Serenity Operating System
1/*
2 * Copyright (c) 2021-2022, the SerenityOS developers.
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#include "WelcomeWidget.h"
8#include <LibConfig/Client.h>
9#include <LibCore/System.h>
10#include <LibGUI/Application.h>
11#include <LibGUI/Icon.h>
12#include <LibGUI/Window.h>
13#include <LibMain/Main.h>
14
15ErrorOr<int> serenity_main(Main::Arguments arguments)
16{
17 TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec"));
18 auto app = TRY(GUI::Application::try_create(arguments));
19
20 Config::pledge_domain("SystemServer");
21
22 TRY(Core::System::unveil("/tmp/session/%sid/portal/webcontent", "rw"));
23 TRY(Core::System::unveil("/tmp/session/%sid/portal/filesystemaccess", "rw"));
24 TRY(Core::System::unveil("/res", "r"));
25 TRY(Core::System::unveil("/home", "r"));
26 TRY(Core::System::unveil("/bin/Help", "x"));
27 TRY(Core::System::unveil(nullptr, nullptr));
28 auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-welcome"sv));
29
30 auto window = TRY(GUI::Window::try_create());
31 window->resize(480, 250);
32 window->center_on_screen();
33 window->set_title("Welcome");
34 window->set_icon(app_icon.bitmap_for_size(16));
35 auto welcome_widget = TRY(window->set_main_widget<WelcomeWidget>());
36
37 window->show();
38
39 return app->exec();
40}