diff options
author | Karol Kosek <krkk@krkk.ct8.pl> | 2021-08-30 21:31:43 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-31 00:46:43 +0200 |
commit | 7d6308523a818d854b59c5d7313ef8e17c8544e5 (patch) | |
tree | b2252be66d7fad40deb21dc570dd9a75ed180381 /Userland | |
parent | dd75ed0c5e32a5e71a7178f49ef6ecbb3fc750dc (diff) | |
download | serenity-7d6308523a818d854b59c5d7313ef8e17c8544e5.zip |
FileManager: Add 'Open in Terminal' action for selected dirs on desktop
This is to be more similar to the context menu from the windowed
instance of File Manager.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/FileManager/main.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index 76172b10c3..5a8c6ad9c8 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -368,6 +368,20 @@ int run_in_desktop_mode() } }); + auto open_terminal_action = GUI::Action::create("Open in &Terminal", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"), [&](auto&) { + auto paths = directory_view.selected_file_paths(); + if (paths.is_empty()) { + spawn_terminal(directory_view.path()); + return; + } + + for (auto& path : paths) { + if (Core::File::is_directory(path)) { + spawn_terminal(path); + } + } + }); + auto display_properties_action = GUI::Action::create("&Display Settings", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"), [&](GUI::Action const&) { Desktop::Launcher::open(URL::create_with_file_protocol("/bin/DisplaySettings")); }); @@ -384,6 +398,7 @@ int run_in_desktop_mode() auto desktop_context_menu = GUI::Menu::construct("Directory View Directory"); desktop_context_menu->add_action(file_manager_action); + desktop_context_menu->add_action(open_terminal_action); desktop_context_menu->add_separator(); desktop_context_menu->add_action(cut_action); desktop_context_menu->add_action(copy_action); |