1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27:35 +00:00

TerminalSettings: Port to LibMain :^)

This commit is contained in:
Andreas Kling 2021-11-27 17:35:00 +01:00
parent 8359975ff3
commit 6b862d5063
2 changed files with 12 additions and 33 deletions

View file

@ -5,51 +5,30 @@
*/
#include "TerminalSettingsWidget.h"
#include <LibCore/System.h>
#include <LibGUI/Application.h>
#include <LibGUI/SettingsWindow.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibMain/Main.h>
// Including this after to avoid LibIPC errors
#include <LibConfig/Client.h>
int main(int argc, char** argv)
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
if (pledge("stdio rpath cpath wpath recvfd sendfd unix proc exec", nullptr) < 0) {
perror("pledge");
return 1;
}
auto app = GUI::Application::construct(argc, argv);
TRY(Core::System::pledge("stdio rpath cpath wpath recvfd sendfd unix proc exec", nullptr));
auto app = TRY(GUI::Application::try_create(arguments));
Config::pledge_domains("Terminal");
if (pledge("stdio rpath cpath wpath recvfd sendfd proc exec", nullptr) < 0) {
perror("pledge");
return 1;
}
if (unveil("/res", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil("/bin/keymap", "x") < 0) {
perror("unveil");
return 1;
}
if (unveil("/proc/keymap", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil(nullptr, nullptr)) {
perror("unveil");
return 1;
}
TRY(Core::System::pledge("stdio rpath cpath wpath recvfd sendfd proc exec", nullptr));
TRY(Core::System::unveil("/res", "r"));
TRY(Core::System::unveil("/bin/keymap", "x"));
TRY(Core::System::unveil("/proc/keymap", "r"));
TRY(Core::System::unveil(nullptr, nullptr));
auto app_icon = GUI::Icon::default_icon("app-terminal");
auto window = GUI::SettingsWindow::construct("Terminal Settings");
auto window = TRY(GUI::SettingsWindow::try_create("Terminal Settings"));
window->set_icon(app_icon.bitmap_for_size(16));
window->add_tab<TerminalSettingsMainWidget>("Terminal");
window->add_tab<TerminalSettingsViewWidget>("View");