diff --git a/Userland/Games/Minesweeper/CMakeLists.txt b/Userland/Games/Minesweeper/CMakeLists.txt index 8118226563..ac76c1bb5f 100644 --- a/Userland/Games/Minesweeper/CMakeLists.txt +++ b/Userland/Games/Minesweeper/CMakeLists.txt @@ -14,4 +14,4 @@ set(SOURCES ) serenity_app(Minesweeper ICON app-minesweeper) -target_link_libraries(Minesweeper LibGUI LibConfig LibMain) +target_link_libraries(Minesweeper LibGUI LibConfig LibMain LibDesktop) diff --git a/Userland/Games/Minesweeper/main.cpp b/Userland/Games/Minesweeper/main.cpp index 6234c413f6..c3ce2be9b1 100644 --- a/Userland/Games/Minesweeper/main.cpp +++ b/Userland/Games/Minesweeper/main.cpp @@ -6,8 +6,10 @@ #include "CustomGameDialog.h" #include "Field.h" +#include #include #include +#include #include #include #include @@ -30,9 +32,13 @@ ErrorOr serenity_main(Main::Arguments arguments) Config::pledge_domains("Minesweeper"); + TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man6/Minesweeper.md") })); + TRY(Desktop::Launcher::seal_allowlist()); + TRY(Core::System::pledge("stdio rpath recvfd sendfd")); TRY(Core::System::unveil("/res", "r")); + TRY(Core::System::unveil("/tmp/portal/launch", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-minesweeper")); @@ -149,6 +155,9 @@ ErrorOr serenity_main(Main::Arguments arguments) difficulty_actions.add_action(action); auto help_menu = TRY(window->try_add_menu("&Help")); + TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) { + Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man6/Minesweeper.md"), "/bin/Help"); + }))); TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Minesweeper", app_icon, window))); window->show();