mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 19:19:44 +03:00
Taskbar: Use Process::spawn_or_show_error() to open the "Run" dialog
This commit is contained in:
parent
c9043280ec
commit
e46b9c189e
Notes:
sideshowbarker
2024-07-18 04:46:35 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/e46b9c189e Pull-request: https://github.com/SerenityOS/serenity/pull/17840 Reviewed-by: https://github.com/LucasChollet Reviewed-by: https://github.com/gmta Reviewed-by: https://github.com/kleinesfilmroellchen ✅
@ -250,22 +250,8 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
|
||||
system_menu->add_action(GUI::Action::create("&Help", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-help.png"sv)), [&](auto&) {
|
||||
GUI::Process::spawn_or_show_error(&window, "/bin/Help"sv);
|
||||
}));
|
||||
system_menu->add_action(GUI::Action::create("&Run...", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-run.png"sv)), [](auto&) {
|
||||
posix_spawn_file_actions_t spawn_actions;
|
||||
posix_spawn_file_actions_init(&spawn_actions);
|
||||
auto home_directory = Core::StandardPaths::home_directory();
|
||||
posix_spawn_file_actions_addchdir(&spawn_actions, home_directory.characters());
|
||||
|
||||
pid_t child_pid;
|
||||
const char* argv[] = { "/bin/Run", nullptr };
|
||||
if ((errno = posix_spawn(&child_pid, "/bin/Run", &spawn_actions, nullptr, const_cast<char**>(argv), environ))) {
|
||||
perror("posix_spawn");
|
||||
} else {
|
||||
if (disown(child_pid) < 0)
|
||||
perror("disown");
|
||||
}
|
||||
|
||||
posix_spawn_file_actions_destroy(&spawn_actions);
|
||||
system_menu->add_action(GUI::Action::create("&Run...", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-run.png"sv)), [&](auto&) {
|
||||
GUI::Process::spawn_or_show_error(&window, "/bin/Run"sv, ReadonlySpan<StringView> {}, Core::StandardPaths::home_directory());
|
||||
}));
|
||||
system_menu->add_separator();
|
||||
system_menu->add_action(GUI::Action::create("E&xit...", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/power.png"sv)), [](auto&) {
|
||||
|
Loading…
Reference in New Issue
Block a user