diff --git a/Base/usr/share/man/man1/Playground.md b/Base/usr/share/man/man1/Playground.md new file mode 100644 index 00000000000..aedcc8a66cb --- /dev/null +++ b/Base/usr/share/man/man1/Playground.md @@ -0,0 +1,28 @@ +## Name + +Playground - GUI Markup Language (GML) editor + +## Synopsis + +```**sh +$ Playground +``` + +## Description + +Playground facilitates development of graphical user interfaces (GUI) +for Serenity applications using GUI Markup Language (GML) to compose +a layout for GUI widgets and set widget attributes. + +The specified widgets are automatically rendered in a live preview +window, allowing rapid prototyping and development of application GUIs. + +## Examples + +```sh +$ Playground +``` + +## See also + +* [`gml-format`(1)](../man1/gml-format.md) For automated GML formatting diff --git a/Base/usr/share/man/man1/gml-format.md b/Base/usr/share/man/man1/gml-format.md new file mode 100644 index 00000000000..dccffa0999d --- /dev/null +++ b/Base/usr/share/man/man1/gml-format.md @@ -0,0 +1,23 @@ +## Name + +gml-format - automated GUI Markup Language (GML) formatter + +## Synopsis + +```**sh +$ gml-format [--inplace] [path...] +``` + +## Description + +`gml-format` formats GUI Markup Language (GML) files. + +## Options + +* `-i`, `--inplace`: Write formatted contents back to file rather than standard output + +## Examples + +```sh +$ gml-format -i /home/anon/example.gml +``` diff --git a/DevTools/Playground/CMakeLists.txt b/DevTools/Playground/CMakeLists.txt index 01e72b95b80..e0fa1867668 100644 --- a/DevTools/Playground/CMakeLists.txt +++ b/DevTools/Playground/CMakeLists.txt @@ -3,4 +3,4 @@ set(SOURCES ) serenity_app(Playground ICON app-playground) -target_link_libraries(Playground LibGUI) +target_link_libraries(Playground LibDesktop LibGUI) diff --git a/DevTools/Playground/main.cpp b/DevTools/Playground/main.cpp index f6becd41ce6..a2dd7cf571d 100644 --- a/DevTools/Playground/main.cpp +++ b/DevTools/Playground/main.cpp @@ -25,8 +25,10 @@ */ #include +#include #include #include +#include #include #include #include @@ -231,6 +233,19 @@ int main(int argc, char** argv) auto app = GUI::Application::construct(argc, argv); + if (pledge("stdio thread shared_buffer accept rpath cpath wpath unix", nullptr) < 0) { + perror("pledge"); + return 1; + } + + if (!Desktop::Launcher::add_allowed_handler_with_only_specific_urls( + "/bin/Help", + { URL::create_with_file_protocol("/usr/share/man/man1/Playground.md") }) + || !Desktop::Launcher::seal_allowlist()) { + warnln("Failed to set up allowed launch URLs"); + return 1; + } + if (pledge("stdio thread shared_buffer accept rpath cpath wpath", nullptr) < 0) { perror("pledge"); return 1; @@ -331,6 +346,9 @@ int main(int argc, char** argv) })); auto& help_menu = menubar->add_menu("Help"); + help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) { + Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/Playground.md"), "/bin/Help"); + })); help_menu.add_action(GUI::Action::create("About", [&](auto&) { GUI::AboutDialog::show("GML Playground", app_icon.bitmap_for_size(32), window); }));