summaryrefslogtreecommitdiff
path: root/Userland/Applications/KeyboardSettings
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-23 23:16:12 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-24 00:25:23 +0100
commit31867bed5c28667ccb247aacb1d3dabcde541388 (patch)
treead801f45b4946660edee01de34984be37b2ddf8e /Userland/Applications/KeyboardSettings
parent10b539350670ddfd5dafbeb23ee1f93ca3f0fd4c (diff)
downloadserenity-31867bed5c28667ccb247aacb1d3dabcde541388.zip
KeyboardSettings: Port to LibMain :^)
Diffstat (limited to 'Userland/Applications/KeyboardSettings')
-rw-r--r--Userland/Applications/KeyboardSettings/CMakeLists.txt2
-rw-r--r--Userland/Applications/KeyboardSettings/main.cpp43
2 files changed, 12 insertions, 33 deletions
diff --git a/Userland/Applications/KeyboardSettings/CMakeLists.txt b/Userland/Applications/KeyboardSettings/CMakeLists.txt
index db79be722f..8a7ccbc475 100644
--- a/Userland/Applications/KeyboardSettings/CMakeLists.txt
+++ b/Userland/Applications/KeyboardSettings/CMakeLists.txt
@@ -13,4 +13,4 @@ set(SOURCES
)
serenity_app(KeyboardSettings ICON app-keyboard-settings)
-target_link_libraries(KeyboardSettings LibGUI LibKeyboard LibConfig)
+target_link_libraries(KeyboardSettings LibGUI LibKeyboard LibConfig LibMain)
diff --git a/Userland/Applications/KeyboardSettings/main.cpp b/Userland/Applications/KeyboardSettings/main.cpp
index a85d126ca8..4e0da94d8b 100644
--- a/Userland/Applications/KeyboardSettings/main.cpp
+++ b/Userland/Applications/KeyboardSettings/main.cpp
@@ -6,51 +6,30 @@
*/
#include "KeyboardSettingsWidget.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("KeyboardSettings");
- 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-keyboard-settings");
- auto window = GUI::SettingsWindow::construct("Keyboard Settings");
+ auto window = TRY(GUI::SettingsWindow::try_create("Keyboard Settings"));
window->set_icon(app_icon.bitmap_for_size(16));
window->add_tab<KeyboardSettingsWidget>("Keyboard");