2021-11-20 21:01:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "TerminalSettingsWidget.h"
|
2022-04-21 11:34:53 -03:00
|
|
|
#include <LibCore/ArgsParser.h>
|
2021-11-27 13:35:00 -03:00
|
|
|
#include <LibCore/System.h>
|
2021-11-20 21:01:21 -03:00
|
|
|
#include <LibGUI/Application.h>
|
2022-02-25 07:39:33 -03:00
|
|
|
#include <LibGUI/ConnectionToWindowServer.h>
|
2021-11-20 21:01:21 -03:00
|
|
|
#include <LibGUI/SettingsWindow.h>
|
2021-11-27 13:35:00 -03:00
|
|
|
#include <LibMain/Main.h>
|
2021-11-20 21:01:21 -03:00
|
|
|
|
|
|
|
|
// Including this after to avoid LibIPC errors
|
|
|
|
|
#include <LibConfig/Client.h>
|
|
|
|
|
|
2021-11-27 13:35:00 -03:00
|
|
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
2021-11-20 21:01:21 -03:00
|
|
|
{
|
2021-11-27 13:36:10 -03:00
|
|
|
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix"));
|
2021-11-27 13:35:00 -03:00
|
|
|
auto app = TRY(GUI::Application::try_create(arguments));
|
2022-02-11 13:33:09 -03:00
|
|
|
Config::pledge_domain("Terminal");
|
2021-11-20 21:01:21 -03:00
|
|
|
|
2022-04-21 11:34:53 -03:00
|
|
|
StringView selected_tab;
|
|
|
|
|
Core::ArgsParser args_parser;
|
|
|
|
|
args_parser.add_option(selected_tab, "Tab, one of 'terminal' or 'view'", "open-tab", 't', "tab");
|
|
|
|
|
args_parser.parse(arguments);
|
|
|
|
|
|
2021-11-27 13:36:10 -03:00
|
|
|
TRY(Core::System::pledge("stdio rpath recvfd sendfd"));
|
2021-11-27 13:35:00 -03:00
|
|
|
TRY(Core::System::unveil("/res", "r"));
|
|
|
|
|
TRY(Core::System::unveil(nullptr, nullptr));
|
2021-11-20 21:01:21 -03:00
|
|
|
|
2022-07-11 14:32:29 -03:00
|
|
|
auto app_icon = GUI::Icon::default_icon("app-terminal"sv);
|
2021-11-20 21:01:21 -03:00
|
|
|
|
2021-11-28 04:34:04 -03:00
|
|
|
auto window = TRY(GUI::SettingsWindow::create("Terminal Settings"));
|
2021-11-20 21:01:21 -03:00
|
|
|
window->set_icon(app_icon.bitmap_for_size(16));
|
2022-07-11 14:32:29 -03:00
|
|
|
(void)TRY(window->add_tab<TerminalSettingsMainWidget>("Terminal"sv, "terminal"sv));
|
|
|
|
|
(void)TRY(window->add_tab<TerminalSettingsViewWidget>("View"sv, "view"sv));
|
2022-04-21 11:34:53 -03:00
|
|
|
window->set_active_tab(selected_tab);
|
2021-11-20 21:01:21 -03:00
|
|
|
|
|
|
|
|
window->show();
|
|
|
|
|
return app->exec();
|
|
|
|
|
}
|