diff options
author | Itamar <itamar8910@gmail.com> | 2020-03-15 19:28:16 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-15 19:09:24 +0100 |
commit | 45d7ea1b634d8d1ada97e35c06f7598a6f4571c6 (patch) | |
tree | 372c5f53329b690c02c57d26da74874a8e255f2f /Applications/FileManager | |
parent | bbe50577f8a5e86b60ed7d3b37a3c1ec09255146 (diff) | |
download | serenity-45d7ea1b634d8d1ada97e35c06f7598a6f4571c6.zip |
FileManager: Add "Open Terminal here" action
Diffstat (limited to 'Applications/FileManager')
-rw-r--r-- | Applications/FileManager/main.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index b3c2407972..d3da9b9f25 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -187,6 +187,15 @@ int main(int argc, char** argv) } }); + auto open_terminal_action = GUI::Action::create("Open Terminal here...", Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"), [&](const GUI::Action&) { + if (!fork()) { + int rc = execl("/bin/Terminal", "Terminal", "-d", directory_view.path().characters(), nullptr); + if (rc < 0) + perror("execl"); + exit(1); + } + }); + RefPtr<GUI::Action> view_as_table_action; RefPtr<GUI::Action> view_as_icons_action; RefPtr<GUI::Action> view_as_columns_action; @@ -553,6 +562,7 @@ int main(int argc, char** argv) file_context_menu->add_action(properties_action); directory_view_context_menu->add_action(mkdir_action); + directory_view_context_menu->add_action(open_terminal_action); tree_view_directory_context_menu->add_action(copy_action); tree_view_directory_context_menu->add_action(paste_action); |