mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 01:05:08 +00:00
FileManager: Move "Open Terminal here" action to DirectoryView
This commit is contained in:
parent
609108f6b3
commit
825fcb8292
3 changed files with 21 additions and 18 deletions
|
@ -484,4 +484,19 @@ void DirectoryView::setup_actions()
|
|||
ASSERT(rc >= 0);
|
||||
}
|
||||
});
|
||||
|
||||
m_open_terminal_action = GUI::Action::create("Open Terminal here...", Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"), [&](auto&) {
|
||||
posix_spawn_file_actions_t spawn_actions;
|
||||
posix_spawn_file_actions_init(&spawn_actions);
|
||||
posix_spawn_file_actions_addchdir(&spawn_actions, path().characters());
|
||||
pid_t pid;
|
||||
const char* argv[] = { "Terminal", nullptr };
|
||||
if ((errno = posix_spawn(&pid, "/bin/Terminal", &spawn_actions, nullptr, const_cast<char**>(argv), environ))) {
|
||||
perror("posix_spawn");
|
||||
} else {
|
||||
if (disown(pid) < 0)
|
||||
perror("disown");
|
||||
}
|
||||
posix_spawn_file_actions_destroy(&spawn_actions);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue