From 24bf74a177b00c93afc198b7589fec39d762dc11 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 23 Nov 2021 15:17:29 +0100 Subject: [PATCH] WorkspacePicker: Port to LibMain :^) --- .../Applets/WorkspacePicker/CMakeLists.txt | 2 +- Userland/Applets/WorkspacePicker/main.cpp | 20 +++++++------------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Userland/Applets/WorkspacePicker/CMakeLists.txt b/Userland/Applets/WorkspacePicker/CMakeLists.txt index f848fee037..1e8b3ab934 100644 --- a/Userland/Applets/WorkspacePicker/CMakeLists.txt +++ b/Userland/Applets/WorkspacePicker/CMakeLists.txt @@ -10,4 +10,4 @@ set(SOURCES ) serenity_bin(WorkspacePicker.Applet) -target_link_libraries(WorkspacePicker.Applet LibGUI LibCore LibGfx) +target_link_libraries(WorkspacePicker.Applet LibGUI LibCore LibGfx LibMain) diff --git a/Userland/Applets/WorkspacePicker/main.cpp b/Userland/Applets/WorkspacePicker/main.cpp index 1e9afb04e9..280de6ab85 100644 --- a/Userland/Applets/WorkspacePicker/main.cpp +++ b/Userland/Applets/WorkspacePicker/main.cpp @@ -5,31 +5,25 @@ */ #include "DesktopStatusWindow.h" +#include #include #include #include +#include #include -#include -#include -int main(int argc, char** argv) +ErrorOr serenity_main(Main::Arguments arguments) { - if (pledge("stdio recvfd sendfd rpath unix", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio recvfd sendfd rpath unix", nullptr)); - auto app = GUI::Application::construct(argc, argv); + auto app = TRY(GUI::Application::try_create(arguments)); // We need to obtain the WM connection here as well before the pledge shortening. GUI::WindowManagerServerConnection::the(); - if (pledge("stdio recvfd sendfd rpath", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio recvfd sendfd rpath", nullptr)); - auto window = DesktopStatusWindow::construct(); + auto window = TRY(DesktopStatusWindow::try_create()); window->set_title("WorkspacePicker"); window->resize(28, 16); window->show();