main.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2020, Hüseyin Aslıtürk <asliturk@hotmail.com>
  3. * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include "KeyboardSettingsWidget.h"
  8. #include <LibCore/System.h>
  9. #include <LibGUI/Application.h>
  10. #include <LibGUI/SettingsWindow.h>
  11. #include <LibGUI/WindowServerConnection.h>
  12. #include <LibMain/Main.h>
  13. // Including this after to avoid LibIPC errors
  14. #include <LibConfig/Client.h>
  15. ErrorOr<int> serenity_main(Main::Arguments arguments)
  16. {
  17. TRY(Core::System::pledge("stdio rpath recvfd sendfd unix proc exec"));
  18. auto app = TRY(GUI::Application::try_create(arguments));
  19. Config::pledge_domains("KeyboardSettings");
  20. TRY(Core::System::pledge("stdio rpath recvfd sendfd proc exec"));
  21. TRY(Core::System::unveil("/res", "r"));
  22. TRY(Core::System::unveil("/bin/keymap", "x"));
  23. TRY(Core::System::unveil("/proc/keymap", "r"));
  24. TRY(Core::System::unveil(nullptr, nullptr));
  25. auto app_icon = GUI::Icon::default_icon("app-keyboard-settings");
  26. auto window = TRY(GUI::SettingsWindow::try_create("Keyboard Settings"));
  27. window->set_icon(app_icon.bitmap_for_size(16));
  28. TRY(window->add_tab<KeyboardSettingsWidget>("Keyboard"));
  29. window->show();
  30. return app->exec();
  31. }