main.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 <LibGUI/Application.h>
  9. #include <LibGUI/SettingsWindow.h>
  10. #include <LibGUI/WindowServerConnection.h>
  11. // Including this after to avoid LibIPC errors
  12. #include <LibConfig/Client.h>
  13. int main(int argc, char** argv)
  14. {
  15. if (pledge("stdio rpath cpath wpath recvfd sendfd unix proc exec", nullptr) < 0) {
  16. perror("pledge");
  17. return 1;
  18. }
  19. auto app = GUI::Application::construct(argc, argv);
  20. Config::pledge_domains("KeyboardSettings");
  21. if (pledge("stdio rpath cpath wpath recvfd sendfd proc exec", nullptr) < 0) {
  22. perror("pledge");
  23. return 1;
  24. }
  25. if (unveil("/res", "r") < 0) {
  26. perror("unveil");
  27. return 1;
  28. }
  29. if (unveil("/bin/keymap", "x") < 0) {
  30. perror("unveil");
  31. return 1;
  32. }
  33. if (unveil("/proc/keymap", "r") < 0) {
  34. perror("unveil");
  35. return 1;
  36. }
  37. if (unveil(nullptr, nullptr)) {
  38. perror("unveil");
  39. return 1;
  40. }
  41. auto app_icon = GUI::Icon::default_icon("app-keyboard-settings");
  42. auto window = GUI::SettingsWindow::construct("Keyboard Settings");
  43. window->set_icon(app_icon.bitmap_for_size(16));
  44. window->add_tab<KeyboardSettingsWidget>("Keyboard");
  45. window->show();
  46. return app->exec();
  47. }